fix: 修复获取版本号问题
This commit is contained in:
parent
6f4cde6ba3
commit
f0341d6078
@ -170,8 +170,10 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
|
|||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
await authStore.getInfo();
|
await authStore.getInfo();
|
||||||
const { data, error } = await fetchVersion();
|
const { data, error } = await fetchVersion();
|
||||||
if (!error) {
|
if (!error && data) {
|
||||||
localStg.set('version', data!);
|
localStg.set('version', data!);
|
||||||
|
} else {
|
||||||
|
localStg.remove('version');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,12 @@ const version = ref<string>(`v${localStg.get('version') || VITE_APP_VERSION}`);
|
|||||||
|
|
||||||
const getVersion = async () => {
|
const getVersion = async () => {
|
||||||
const { data, error } = await fetchVersion();
|
const { data, error } = await fetchVersion();
|
||||||
if (!error) {
|
if (!error && data) {
|
||||||
version.value = data;
|
version.value = data;
|
||||||
localStg.set('version', data);
|
localStg.set('version', data);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
localStg.remove('version');
|
||||||
};
|
};
|
||||||
|
|
||||||
getVersion();
|
getVersion();
|
||||||
|
Loading…
Reference in New Issue
Block a user