Make OAuth tokens API more resilient
This commit is contained in:
parent
845ef1c4d4
commit
ad6d03b4eb
2 changed files with 14 additions and 12 deletions
|
@ -50,7 +50,7 @@ const MOVE_ACCOUNT_FAIL = 'MOVE_ACCOUNT_FAIL';
|
||||||
const fetchOAuthTokens = () =>
|
const fetchOAuthTokens = () =>
|
||||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||||
dispatch({ type: FETCH_TOKENS_REQUEST });
|
dispatch({ type: FETCH_TOKENS_REQUEST });
|
||||||
return api(getState).get('/api/oauth_tokens.json').then(({ data: tokens }) => {
|
return api(getState).get('/api/oauth_tokens').then(({ data: tokens }) => {
|
||||||
dispatch({ type: FETCH_TOKENS_SUCCESS, tokens });
|
dispatch({ type: FETCH_TOKENS_SUCCESS, tokens });
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
dispatch({ type: FETCH_TOKENS_FAIL });
|
dispatch({ type: FETCH_TOKENS_FAIL });
|
||||||
|
|
|
@ -45,17 +45,19 @@ const AuthToken: React.FC<IAuthToken> = ({ token, isCurrent }) => {
|
||||||
<Stack space={2}>
|
<Stack space={2}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Text size='md' weight='medium'>{token.app_name}</Text>
|
<Text size='md' weight='medium'>{token.app_name}</Text>
|
||||||
<Text size='sm' theme='muted'>
|
{token.valid_until && (
|
||||||
<FormattedDate
|
<Text size='sm' theme='muted'>
|
||||||
value={new Date(token.valid_until)}
|
<FormattedDate
|
||||||
hour12
|
value={token.valid_until}
|
||||||
year='numeric'
|
hour12
|
||||||
month='short'
|
year='numeric'
|
||||||
day='2-digit'
|
month='short'
|
||||||
hour='numeric'
|
day='2-digit'
|
||||||
minute='2-digit'
|
hour='numeric'
|
||||||
/>
|
minute='2-digit'
|
||||||
</Text>
|
/>
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<div className='flex justify-end'>
|
<div className='flex justify-end'>
|
||||||
|
|
Loading…
Reference in a new issue