-
Notifications
You must be signed in to change notification settings - Fork 0
Home
François Gérard edited this page Sep 6, 2019
·
3 revisions
import {whoamiV1} from 'ps-web-apis'
whoamiV1().then(whoami => {
if (whoami.isLoggedId()) {
whoami.authorizedFetch(...)
.then((resp) => /*handleResp(resp)*/)
.catch(/* handle unauthorized */)
} else {
fetch(...)
.then((resp) => /*handleResp(resp)*/)
.catch(/* handle communication error*/)
} ).catch(() => {
console.error('handle unavilability of whoami api')
});