refactor: prefetch basic data and window visibility change event in streaming
This commit is contained in:
@@ -217,6 +217,7 @@ export const {
|
||||
useLazyGuestLoginQuery,
|
||||
useGuestLoginQuery,
|
||||
useLazyCheckEmailQuery,
|
||||
useLazyGetInitializedQuery,
|
||||
useGetInitializedQuery,
|
||||
useSendLoginMagicLinkMutation,
|
||||
useSendRegMagicLinkMutation,
|
||||
|
||||
@@ -237,7 +237,17 @@ export const serverApi = createApi({
|
||||
})
|
||||
}),
|
||||
getLoginConfig: builder.query<LoginConfig, void>({
|
||||
query: () => ({ url: `/admin/login/config` })
|
||||
query: () => ({ url: `/admin/login/config` }),
|
||||
async onQueryStarted(data, { dispatch, queryFulfilled }) {
|
||||
try {
|
||||
const resp = await queryFulfilled;
|
||||
if (resp.data) {
|
||||
dispatch(updateInfo({ loginConfig: resp.data }));
|
||||
}
|
||||
} catch {
|
||||
console.error("get login config error");
|
||||
}
|
||||
}
|
||||
}),
|
||||
getFiles: builder.query<VoceChatFile[], GetFilesDTO>({
|
||||
query: (params) => ({
|
||||
|
||||
Reference in New Issue
Block a user