I use RTK Query api for login, when the login is done with success, i get the token through the response header.
Is there any chance to access the 'Authorization' from the response header. I try it to build an custom baseQuery but i failed.
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
import { ILoginUser } from "./types";
const api = process.env.REACT_APP_BASEURL_DEV;
export const authApi = createApi({
reducerPath: "authApi",
baseQuery: fetchBaseQuery({
baseUrl: `${api}`,
}),
endpoints: (builder) => ({
signIn: builder.mutation({
query: (body: ILoginUser) => {
return {
url: "/login",
method: "post",
body,
};
},
}),
}),
});
export const { useSignInMutation } = authApi;