Browse Source

fix router

SyuanYu 2 years ago
parent
commit
c018daa174
1 changed files with 5 additions and 5 deletions
  1. 5 5
      frontend/src/stores/main.ts

+ 5 - 5
frontend/src/stores/main.ts

@@ -7,7 +7,6 @@ import type { AppNotification } from '@/interfaces';
 import type { IUserProfile, IUserProfileCreate, IUserProfileUpdate, MainState, Video} from '@/interfaces';
 import i18n from '@/plugins/i18n'
 
-// const { t } = useI18n();
 const defaultState: MainState = {
   isLoggedIn: null,
   token: '',
@@ -64,7 +63,7 @@ export const useMainStore = defineStore("MainStoreId", {
           this.setLogInError(false);
           await this.getUserProfile();
           await this.routeLoggedIn();
-          this.addNotification({ content: "Logged in", color: "success" });
+          this.addNotification({ content: i18n.global.t("loggedIn"), color: "success" });
         } else {
           await this.logOut();
         }
@@ -96,7 +95,7 @@ export const useMainStore = defineStore("MainStoreId", {
         this.setUserProfile(response.data);
         this.removeNotification(loadingNotification);
         this.addNotification({
-          content: "Profile successfully updated",
+          content: i18n.global.t("profileUpdated"),
           color: "success",
         });
       } catch (error) {
@@ -118,6 +117,7 @@ export const useMainStore = defineStore("MainStoreId", {
             const response = await api.getMe(token);
             this.setLoggedIn(true);
             this.setUserProfile(response.data);
+            router.push("/main/dashboard");
           } catch (error) {
             await this.removeLogIn();
           }
@@ -166,7 +166,7 @@ export const useMainStore = defineStore("MainStoreId", {
     },
     async register(payload: IUserProfileCreate) {
       const loadingNotification = {
-        content: i18n.global.t("sginingUp"),
+        content: i18n.global.t("signingUp"),
         showProgress: true,
       };
       try {
@@ -179,7 +179,7 @@ export const useMainStore = defineStore("MainStoreId", {
         )[0];
         this.removeNotification(loadingNotification);
         this.addNotification({
-          content: i18n.global.t("successfully"),
+          content: i18n.global.t("registerSuccess"),
           color: "success",
         });
         setTimeout(() => {