diff --git a/src/store/authStore.js b/src/store/authStore.js index 0e685fa..d78d370 100644 --- a/src/store/authStore.js +++ b/src/store/authStore.js @@ -6,11 +6,11 @@ export const useAuthStore = defineStore('auth', { token: sessionStorage.getItem('token'), authenticated: !!sessionStorage.getItem('token'), }), - + getters: { getUser: (state) => state.user, isAuthenticated: (state) => state.authenticated, - getToken: (state) => state.token + getToken: (state) => state.token, }, actions: { login(user, token) { @@ -27,11 +27,12 @@ export const useAuthStore = defineStore('auth', { sessionStorage.setItem('user', JSON.stringify(this.user)) sessionStorage.setItem('token', this.token); }, - setToken(token) { - this.token = token; - }, setUser(user){ this.user = user; + }, + isAdmin() { + console.log(JSON.stringify(this.user)) + return this.user.role === 'ADMIN'; } }, }); diff --git a/src/views/Exemplarisation/ExempSteps.vue b/src/views/Exemplarisation/ExempSteps.vue index fb12d81..858eecc 100644 --- a/src/views/Exemplarisation/ExempSteps.vue +++ b/src/views/Exemplarisation/ExempSteps.vue @@ -108,7 +108,7 @@