Untitled
unknown
javascript
3 years ago
710 B
9
Indexable
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
export const jobadsApi = createApi({
reducerPath: 'bookingApi',
baseQuery: fetchBaseQuery({
baseUrl: '/api',
prepareHeaders: async (headers) => {
const access_token =
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwdWJsaWMudG9rZW4udjFAbmF2Lm5vIiwiYXVkIjoiZmVlZC1hcGktdjEiLCJpc3MiOiJuYXYubm8iLCJpYXQiOjE1NTc0NzM0MjJ9.jNGlLUF9HxoHo5JrQNMkweLj_91bgk97ZebLdfx3_UQ';
if (access_token) {
headers.set('authorization', `Bearer ${access_token}`);
}
return headers;
},
}),
endpoints: (builder) => ({
getJobAds: builder.query({
query: () => '',
}),
}),
});
export const { useGetJobAdsQuery } = jobadsApi;
Editor is loading...