Skip to content

Commit

Permalink
chore: 增加延时 防止频繁请求
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 20, 2024
1 parent a72a2e0 commit 72906b8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.93",
"version": "2.14.94",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
4 changes: 2 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ router.beforeResolve(async (to, from) => {
// 路由跳转时查询环境,决定是否更新数据
if (globalStore !== null) {
const storeEnv = toRaw(globalStore.env);
if (storeEnv?.backend && storeEnv?.version) {
// if (storeEnv?.backend && storeEnv?.version) {
useEnvApi()
.getEnv()
.then(async res => {
Expand All @@ -257,7 +257,7 @@ router.beforeResolve(async (to, from) => {
}
}
});
}
// }
} else {
globalStore = useGlobalStore();
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/subs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const useSubsStore = defineStore('subsStore', {
},
actions: {
async fetchSubsData() {
Promise.all([subsApi.getSubs(), subsApi.getCollections(), filesApi.getWholeFiles()]).then(res => {
await Promise.all([subsApi.getSubs(), subsApi.getCollections(), filesApi.getWholeFiles()]).then(res => {
if ('data' in res[0].data) {
this.subs = res[0].data.data;
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/initApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const initStores = async (
try {
localStorage.removeItem("envCache");
await subsStore.fetchSubsData();
await new Promise((resolve) => setTimeout(resolve, 50));
await artifactsStore.fetchArtifactsData();
await settingsStore.fetchSettings();
await globalStore.setEnv();
Expand Down

0 comments on commit 72906b8

Please sign in to comment.