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