return false from isTokenValid only if api resonse is 401
This commit is contained in:
parent
49ce07ffc9
commit
f9b143c67a
|
@ -18,6 +18,7 @@ import {
|
|||
UserDetails,
|
||||
} from 'types/user';
|
||||
import { getFamilyData, isPartOfFamily } from 'utils/billing';
|
||||
import { ServerErrorCodes } from 'utils/error';
|
||||
|
||||
const ENDPOINT = getEndpoint();
|
||||
|
||||
|
@ -161,7 +162,12 @@ export const isTokenValid = async () => {
|
|||
}
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
logError(e, 'session-validity api call failed');
|
||||
if (e.status?.toString() === ServerErrorCodes.SESSION_EXPIRED) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue