feat: lots updates
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createApi } from "@reduxjs/toolkit/query/react";
|
||||
import { nanoid } from "@reduxjs/toolkit";
|
||||
import baseQuery from "./base.query";
|
||||
import { updateToken, resetAuthData } from "../slices/auth.data";
|
||||
import BASE_URL, { KEY_DEVICE_KEY } from "../config";
|
||||
const getDeviceId = () => {
|
||||
let d = localStorage.getItem(KEY_DEVICE_KEY);
|
||||
@@ -43,6 +44,15 @@ export const authApi = createApi({
|
||||
refresh_token: refreshToken,
|
||||
},
|
||||
}),
|
||||
async onQueryStarted(params, { dispatch, queryFulfilled }) {
|
||||
try {
|
||||
const { data } = await queryFulfilled;
|
||||
dispatch(updateToken(data));
|
||||
} catch {
|
||||
dispatch(resetAuthData());
|
||||
console.log("remove channel error");
|
||||
}
|
||||
},
|
||||
}),
|
||||
// 获取openid
|
||||
getOpenid: builder.mutation({
|
||||
|
||||
Reference in New Issue
Block a user