feat: 修改用户名,简化代码

This commit is contained in:
naiba
2024-11-30 15:02:42 +08:00
parent e42910ad35
commit c98632bc17
15 changed files with 395 additions and 447 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
import { useMainStore } from "@/hooks/useMainStore";
interface CommonResponse<T> {
success: boolean;
error: string;
@@ -48,7 +50,7 @@ export async function fetcher<T>(method: FetcherMethod, path: string, data?: any
}
// auto refresh token
if (!lastestRefreshTokenAt || Date.now() - lastestRefreshTokenAt > 1000 * 60 * 60) {
if (document.cookie && (!lastestRefreshTokenAt || Date.now() - lastestRefreshTokenAt > 1000 * 60 * 60)) {
lastestRefreshTokenAt = Date.now();
fetch("/api/v1/refresh-token")
}