design changes

This commit is contained in:
2024-04-12 18:47:19 +03:00
parent 57965fc147
commit d6cfedfe06
14 changed files with 55 additions and 40 deletions

View File

@ -0,0 +1,24 @@
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
import { baseUrl } from "../config/baseUrl";
import { RootState } from "../config/store";
export const QueueApi = createApi({
reducerPath: "QueueApi",
baseQuery: fetchBaseQuery({
baseUrl: `${baseUrl}/queue`,
prepareHeaders: (headers, { getState }) => {
const token = (getState() as RootState).auth.token;
if (token) {
headers.set("authorization", `Bearer ${token}`);
}
return headers;
},
}),
endpoints: (builder) => ({
getQueues: builder.query({
query: () => "/",
}),
}),
});
export const { useGetQueuesQuery } = QueueApi;