Untitled
unknown
javascript
3 years ago
997 B
7
Indexable
interface JobAd {
id: string;
title: string;
jobTitle: string;
extent: string;
expires: string;
description: string;
}
interface JobAdsQueryResponse {
content: JobAd[];
}
export const JobAds = () => {
const { data } = useGetJobAdsQuery<JobAdsQueryResponse>('');
// jobadsApi
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...