yangdx
commited on
Commit
·
d27ca31
1
Parent(s):
92edc1a
Improve authentication flow and navigation handling
Browse files- Replace never-resolving promise with rejection
- Remove unnecessary setTimeout in navigation
lightrag_webui/src/api/lightrag.ts
CHANGED
@@ -186,8 +186,9 @@ axiosInstance.interceptors.response.use(
|
|
186 |
}
|
187 |
// For other APIs, navigate to login page
|
188 |
navigationService.navigateToLogin();
|
189 |
-
|
190 |
-
return
|
|
|
191 |
}
|
192 |
throw new Error(
|
193 |
`${error.response.status} ${error.response.statusText}\n${JSON.stringify(
|
|
|
186 |
}
|
187 |
// For other APIs, navigate to login page
|
188 |
navigationService.navigateToLogin();
|
189 |
+
|
190 |
+
// return a reject Promise
|
191 |
+
return Promise.reject(new Error('Authentication required'));
|
192 |
}
|
193 |
throw new Error(
|
194 |
`${error.response.status} ${error.response.statusText}\n${JSON.stringify(
|
lightrag_webui/src/services/navigation.ts
CHANGED
@@ -67,14 +67,10 @@ class NavigationService {
|
|
67 |
return;
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
setTimeout(() => {
|
75 |
-
this.resetAllApplicationState();
|
76 |
-
useAuthStore.getState().logout();
|
77 |
-
}, 0);
|
78 |
}
|
79 |
|
80 |
navigateToHome() {
|
|
|
67 |
return;
|
68 |
}
|
69 |
|
70 |
+
this.resetAllApplicationState();
|
71 |
+
useAuthStore.getState().logout();
|
72 |
|
73 |
+
this.navigate('/login');
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
navigateToHome() {
|