Make OAuth tokens API more resilient

This commit is contained in:
Alex Gleason 2023-01-24 12:00:34 -06:00
parent 845ef1c4d4
commit ad6d03b4eb
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 14 additions and 12 deletions

View file

@ -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 });

View file

@ -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'>