Merged in feature/clear-cache (pull request #44)
Reset cache on logout, refactor logout
This commit is contained in:
commit
d829d898b8
|
|
@ -14,7 +14,7 @@
|
|||
this.$apollo.mutate({
|
||||
mutation: LOGOUT_MUTATION,
|
||||
}).then(({data}) => {
|
||||
if (data.logout.success) { location.replace('/') }
|
||||
if (data.logout.success) { location.replace('/logout') }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
mutation: LOGOUT_MUTATION,
|
||||
}).then(({data}) => {
|
||||
if (data.logout.success) {
|
||||
location.replace('/')
|
||||
location.replace('/logout')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,13 +138,22 @@ function redirectStudentsWithoutClass() {
|
|||
}
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
// handle logout
|
||||
if (to.path === '/logout') {
|
||||
privateApolloClient.resetStore();
|
||||
next({name: 'login'});
|
||||
return
|
||||
}
|
||||
|
||||
if (unauthorizedAccess(to)) {
|
||||
const redirectUrl = `/login?redirect=${to.path}`;
|
||||
next(redirectUrl);
|
||||
return
|
||||
}
|
||||
|
||||
if (to.name !== 'noClass' && loginRequired(to) && await redirectStudentsWithoutClass()) {
|
||||
router.push({name: 'noClass'})
|
||||
next({name: 'noClass'})
|
||||
return
|
||||
}
|
||||
|
||||
next();
|
||||
|
|
|
|||
|
|
@ -91,14 +91,8 @@ export default {
|
|||
passwordInput: this.password
|
||||
}
|
||||
},
|
||||
update(
|
||||
store,
|
||||
{
|
||||
data: {
|
||||
login
|
||||
}
|
||||
}
|
||||
) {
|
||||
fetchPolicy: 'no-cache',
|
||||
}).then(({data: {login}}) => {
|
||||
try {
|
||||
if (login.success) {
|
||||
const redirectUrl = that.$route.query.redirect ? that.$route.query.redirect : '/'
|
||||
|
|
@ -118,7 +112,6 @@ export default {
|
|||
console.warn(e);
|
||||
that.loginError = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie nochmals.';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -128,7 +121,7 @@ export default {
|
|||
this.password = '';
|
||||
this.submitted = false;
|
||||
this.$validator.reset();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
|
|
|
|||
|
|
@ -144,14 +144,9 @@ export default {
|
|||
licenseKeyInput: this.licenseKey,
|
||||
}
|
||||
},
|
||||
update(
|
||||
store,
|
||||
{
|
||||
data: {
|
||||
registration: { success, errors }
|
||||
}
|
||||
}
|
||||
) {
|
||||
fetchPolicy: 'no-cache'
|
||||
})
|
||||
.then(({data: {registration: { success, errors }}}) => {
|
||||
try {
|
||||
if (success) {
|
||||
window.location.href = '/registration/set-password/done/';
|
||||
|
|
@ -170,7 +165,6 @@ export default {
|
|||
console.warn(e);
|
||||
that.registrationError = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie nochmals.';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue