refactor: rename contact with user

This commit is contained in:
Tristan Yang
2022-07-04 16:12:23 +08:00
parent 6083040e2b
commit 101dbdb5ee
76 changed files with 319 additions and 286 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ import toast from "react-hot-toast";
import dayjs from "dayjs";
import { updateToken, resetAuthData } from "../slices/auth.data";
import BASE_URL, { tokenHeader } from "../config";
import { RootState } from "../store";
const whiteList = [
"login",
@@ -28,7 +29,7 @@ const baseQuery = fetchBaseQuery({
baseUrl: BASE_URL,
prepareHeaders: (headers, { getState, endpoint }) => {
console.log("req", endpoint);
const { token } = getState().authData;
const { token } = (getState() as RootState).authData;
if (token && !whiteList.includes(endpoint)) {
headers.set(tokenHeader, token);
}