Код: Выделить всё
import { myApi } from "./myApi";
import { fetchBaseQuery } from "@reduxjs/toolkit/query/react";
export const createMyApi = (baseUrl, getTokenFunction) => {
const newBaseQuery = fetchBaseQuery({
baseUrl,
prepareHeaders: (headers) => {
headers.set("Authorization", `Bearer ${getTokenFunction()}`);
return headers;
},
});
return ??? // return a version of the generated 'myApi' that uses newBaseQuery
};
Подробнее здесь: https://stackoverflow.com/questions/797 ... -to-my-api
Мобильная версия