mirror of
https://github.com/ershisan99/inctagram-live-2024-08-30.git
synced 2026-01-30 12:35:01 +00:00
lesson 4
This commit is contained in:
@@ -10,21 +10,13 @@ import {
|
||||
UserPosts,
|
||||
UserProfile,
|
||||
} from '@/services/instagram.types'
|
||||
import { baseQueryWithReauth } from '@/services/instagram.base-query'
|
||||
|
||||
// Define a service using a base URL and expected endpoints
|
||||
export const instagramApi = createApi({
|
||||
tagTypes: ['Posts'],
|
||||
reducerPath: 'instagramApi',
|
||||
baseQuery: fetchBaseQuery({
|
||||
baseUrl: 'https://inctagram.work/api/',
|
||||
prepareHeaders: (headers) => {
|
||||
const token = localStorage.getItem('access_token')
|
||||
if (token) {
|
||||
headers.set('Authorization', `Bearer ${token}`)
|
||||
}
|
||||
return headers
|
||||
},
|
||||
}),
|
||||
baseQuery: baseQueryWithReauth,
|
||||
endpoints: (builder) => ({
|
||||
getAllPublicPosts: builder.query<
|
||||
GetAllPostsResponse,
|
||||
|
||||
Reference in New Issue
Block a user