Implement exercise 2.1

This commit is contained in:
2024-11-18 16:12:58 +01:00
parent 24561fba23
commit 22684fea44

View File

@@ -55,6 +55,7 @@ export const useAccountStore = defineStore("accountStore", {
*/
async login(): Promise<boolean> {
const feedbackStore = useFeedbackStore()
const exerciseStore = useExerciseStore()
this.fetchInProgress = true
// Validate
@@ -72,14 +73,18 @@ export const useAccountStore = defineStore("accountStore", {
this.userAccountToken = result.data.token
getAccount(this.userAccountToken)
.then(account => {
this.userAccount = account.data
.then(response => {
this.userAccount = response.data
feedbackStore.addSnackbar(BannerStateEnum.ACCOUNTLOGINSUCCESSFUL)
this.fetchInProgress = false
this.privilegeBuy = true
this.adminPanelVisible = account.data.accountRole.privilegeAdminPanel
this.adminPanelVisible = response.data.accountRole.privilegeAdminPanel
if (response.data.accountRoleId == 3) {
exerciseStore.solveExercise(2, 1)
}
})
})
.catch(error => {