refactor: router guard
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { userClient } from '@/apis/client';
|
||||
import type { Station } from '@/apis/domains';
|
||||
import { ndmVerify } from '@/apis/requests';
|
||||
import { STATION_LIST_QUERY_KEY } from '@/constants';
|
||||
@@ -22,6 +23,12 @@ export function useStationListQuery() {
|
||||
enabled: computed(() => pollingEnabled.value),
|
||||
refetchInterval: getAppEnvConfig().requestInterval * 1000,
|
||||
queryFn: async () => {
|
||||
// 主动登录校验
|
||||
const [err] = await userClient.post<void>(`/api/ndm/ndmKeepAlive/verify`, {}, { timeout: 5000 });
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
const { data: ndmStationList } = await axios.get<{ code: string; name: string }[]>(`/minio/ndm/ndm-stations.json?_t=${dayjs().unix()}`);
|
||||
|
||||
let stations = ndmStationList.map<Station>((station) => ({
|
||||
|
||||
Reference in New Issue
Block a user