INNER CODE UNIT · JavaScript
checkAuthError
ongres/stackgres · stackgres-k8s/src/admin-ui/src/router/index.js:814
function checkAuthError(error) {
if(error.response) {
if(error.response.status == 401 ) {
document.cookie = 'sgToken=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT; SameSite=Strict;';
store.commit('setLoginToken');
window.location.replace('/admin/')
process.exit(1);
} else if(error.response.status == 403 ) {
// Little hack to store the right plural kind to validate RBAC permissions
if(error.response.config.url.includes('sgcluster/stats'))
kind = 'stats'
else
kind = error.response.config.url.replace('/stackgres/','')+'s';
store.commit('setNoPermissions', kind);
}
}