|
@@ -168,7 +168,17 @@ export const useMainStore = defineStore("MainStoreId", {
|
|
|
const response = await api.getMe(token);
|
|
|
this.setLoggedIn(true);
|
|
|
this.setUserProfile(response.data);
|
|
|
- router.push("/main/dashboard");
|
|
|
+ // router.push("/main/dashboard");
|
|
|
+
|
|
|
+ // 取得網址路徑
|
|
|
+ const currentPath = window.location.pathname;
|
|
|
+
|
|
|
+ if (currentPath === "/login") {
|
|
|
+ router.push("/main/dashboard");
|
|
|
+ } else {
|
|
|
+ // 跳轉至目前路徑
|
|
|
+ router.push(currentPath);
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
await this.removeLogIn();
|
|
|
}
|