first commit

This commit is contained in:
Inshal
2024-05-29 22:34:28 +05:00
commit e63fc41a20
1470 changed files with 174828 additions and 0 deletions

14
resources/js/utils/api.js Normal file
View File

@@ -0,0 +1,14 @@
import { ofetch } from 'ofetch'
export const $api = ofetch.create({
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
async onRequest({ options }) {
const accessToken = useCookie('accessToken').value
if (accessToken) {
options.headers = {
...options.headers,
Authorization: `Bearer ${accessToken}`,
}
}
},
})