Skip to content

Instantly share code, notes, and snippets.

@8lane
Last active July 4, 2017 16:13
Show Gist options
  • Save 8lane/f33f416e80a47128e621eae8edcd7f6f to your computer and use it in GitHub Desktop.
Save 8lane/f33f416e80a47128e621eae8edcd7f6f to your computer and use it in GitHub Desktop.
isLoggedIn: (redirect=false) => {
return CMS.get({
url: App.SiteURL + '/api/SessionActive/',
data: {
channelId: getDevice() === 'mobile' ? 2 : 1
}
}).then(response => {
if (response.data || response.accessToken) {
return true;
}
return false;
}, error => {
if(error.status === '403' || error.status === 403) {
OpenLogin();
return false;
}
if(redirect) {
OpenLogin();
}
return false;
})
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment