Remove hardcoded token (thanks chrome)

This commit is contained in:
Nicholas Zuber 2019-05-05 14:24:15 -04:00
parent 1e85f51f53
commit b3ccb79a9e
4 changed files with 38 additions and 4 deletions

View File

@ -14,8 +14,6 @@ import iPhoneXMockupPng from '../../images/screenshots/iphone-x-mockup.png';
import iPhoneScreenshotPng from '../../images/screenshots/iphone-x.png';
import { ReactComponent as MentionSvg } from '../../images/svg/mention.svg';
import { ReactComponent as GoodTeamSvg } from '../../images/svg/good-team.svg';
import { ReactComponent as BloomingSvg } from '../../images/svg/blooming.svg'
import { ReactComponent as ListSvg } from '../../images/svg/list.svg'
import { ReactComponent as ProcessgSvg } from '../../images/svg/process.svg'
import { ReactComponent as MobileSvg } from '../../images/svg/mobile.svg'

View File

@ -7,6 +7,7 @@ import {css, jsx, keyframes} from '@emotion/core';
import {navigate} from "@reach/router"
import {useSpring, useTransition, animated} from 'react-spring'
import {LineChart, Line, XAxis, Tooltip} from 'recharts';
import { ReactComponent as BlankCanvasSvg } from '../../../images/svg/blank.svg'
import Logo from '../../../components/Logo';
import LoadingIcon from '../../../components/LoadingIcon'
import {routes} from '../../../constants';
@ -31,6 +32,15 @@ const WIDTH_FOR_SMALL_SCREENS = '750px';
// START OF 'MOVE TO A UTILS FILE'
// ========================================================================
function stringOfError (errorText) {
switch (errorText) {
case 'Unauthorized':
return 'Your credentials have expired.';
default:
return errorText;
}
}
function getPRIssueIcon (type, _reasons) {
switch (type) {
case 'PullRequest':
@ -653,6 +663,20 @@ const LoadingNotificationRow = styled(NotificationRowHeader)`
const NotificationBlock = styled('tbody')``;
const ErrorContainer = styled('div')`
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding: 48px;
h3 {
font-size: 20px;
font-weight: 500;
margin-bottom: 0;
text-align: center;
}
`;
const AnimatedNotificationRow = animated(NotificationRow);
const AnimatedNotificationsBlock = animated(NotificationBlock);
@ -1702,7 +1726,11 @@ export default function Scene ({
<LoadingNotificationRow />
</NotificationBlock>
) : error ? (
<p>error</p>
<ErrorContainer>
<BlankCanvasSvg height={136} width={224} />
<h3>{'Something went wrong'}</h3>
<p>{stringOfError(error.text)}</p>
</ErrorContainer>
) : (
<NotificationCollection
page={page}

View File

@ -6,7 +6,7 @@ const {Provider, Consumer} = React.createContext();
class AuthProvider extends React.Component {
state = {
token: this.props.cookiesApi.getCookie(OAUTH_TOKEN_COOKIE) || '768615842405af34b4511b2bd6c52b0e7c36211e'
token: this.props.cookiesApi.getCookie(OAUTH_TOKEN_COOKIE)
}
setToken = token => {

View File

@ -47,6 +47,13 @@ function processHeadersAndBodyJson (response) {
});
}
if (response.status >= 400) {
return Promise.reject({
text: response.statusText,
status: response.status
});
}
return response.json().then(json => ({
headers,
json
@ -197,6 +204,7 @@ class NotificationsProvider extends React.Component {
}
processNotificationsChunk = (nextPage, notificationsChunk) => {
console.warn('notificationsChunk', notificationsChunk)
return new Promise((resolve, reject) => {
let everythingUpdated = true;