|
@@ -266,14 +266,24 @@ export const useMainStore = defineStore("MainStoreId", {
|
|
|
await mainStore.checkApiError(error);
|
|
|
}
|
|
|
},
|
|
|
- async googleLogin(access_token:string) {
|
|
|
- try{
|
|
|
- const response = await api.googleLogin(access_token)
|
|
|
- if (response) {
|
|
|
- console.log(response)
|
|
|
+ async googleLogin(username:string, password: string) {
|
|
|
+ try {
|
|
|
+ const response = await api.googleLogInGetToken(username, password);
|
|
|
+ const token: string = response.data.access_token;
|
|
|
+ if (token) {
|
|
|
+ saveLocalToken(token);
|
|
|
+ this.setToken(token);
|
|
|
+ this.setLoggedIn(true);
|
|
|
+ this.setLogInError(false);
|
|
|
+ await this.getUserProfile();
|
|
|
+ await this.routeLoggedIn();
|
|
|
+ this.addNotification({ content: i18n.global.t("loggedIn"), color: "success" });
|
|
|
+ } else {
|
|
|
+ await this.logOut();
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- await this.checkApiError(error)
|
|
|
+ } catch (err) {
|
|
|
+ this.setLogInError(true);
|
|
|
+ await this.logOut();
|
|
|
}
|
|
|
}
|
|
|
}
|