Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 35b4b88

Browse files
committedDec 11, 2023
feat: wip api client
1 parent 6e9c1fb commit 35b4b88

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 

‎src/api/api-client.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import axios, { AxiosResponse } from 'axios'
2+
import {auth} from '@/app/api/auth/[...nextauth]/route'
3+
4+
export const getBearerToken = async () => {
5+
const session = await auth()
6+
7+
return `Bearer ${session?.accessToken}`
8+
}
9+
10+
const api = axios.create({
11+
baseURL: process.env.BACKEND_API_URL,
12+
// headers: {
13+
// 'Authorization': await getBearerToken(),
14+
// },
15+
})
16+
api.defaults.headers.common['Content-Type'] = 'application/json'
17+
18+
export { api }

0 commit comments

Comments
 (0)
Please sign in to comment.