Skip to content

Commit 3830ec7

Browse files
committed
fix(projects): fix login redirect
1 parent ef6cf93 commit 3830ec7

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/hooks/common/router.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@ export function useRouterPush(inSetup = true) {
9393
return routerPushByKey('login', { query, params: { module } });
9494
}
9595

96-
/** Redirect from login */
97-
async function redirectFromLogin() {
96+
/**
97+
* Redirect from login
98+
*
99+
* @param [needRedirect=true] Whether to redirect after login. Default is `true`
100+
*/
101+
async function redirectFromLogin(needRedirect = true) {
98102
const redirect = route.value.query?.redirect as string;
99103

100-
if (redirect) {
104+
if (needRedirect && redirect) {
101105
routerPush(redirect);
102106
} else {
103107
toHome();

src/store/modules/auth/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
7171
if (pass) {
7272
await routeStore.initAuthRoute();
7373

74-
if (redirect) {
75-
await redirectFromLogin();
76-
}
74+
await redirectFromLogin(redirect);
7775

7876
if (routeStore.isInitAuthRoute) {
7977
window.$notification?.success({

0 commit comments

Comments
 (0)