Compare commits
2 Commits
5d62e751b3
...
98fdf1c3fb
Author | SHA1 | Date | |
---|---|---|---|
![]() |
98fdf1c3fb | ||
![]() |
219f12c2b2 |
|
@ -8,8 +8,8 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||
const api = $fetch.create({
|
||||
onRequest({ request, options, error }) {
|
||||
options.baseURL =
|
||||
config.public.NUXT_PUBLIC_BASE_URL +
|
||||
config.public.NUXT_PUBLIC_API_NAME +
|
||||
config.public.VITE_BASE_URL +
|
||||
config.public.VITE_API_NAME +
|
||||
options.baseURL;
|
||||
|
||||
if (token) {
|
||||
|
@ -38,10 +38,10 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||
|
||||
// Add custom methods for GET, POST, and DELETE
|
||||
const http = {
|
||||
getRequest: (url, options = {}) => api(url, { method: "GET", ...options }),
|
||||
postRequest: (url, body, options = {}) =>
|
||||
getRequest: (url: string, options = {}) => api(url, { method: "GET", ...options }),
|
||||
postRequest: (url: string, body: any, options = {}) =>
|
||||
api(url, { method: "POST", body, ...options }),
|
||||
deleteRequest: (url, options = {}) =>
|
||||
deleteRequest: (url: string, options = {}) =>
|
||||
api(url, { method: "DELETE", ...options }),
|
||||
};
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit daf14f2b1b116129a1c19e732df84d38d07b6275
|
||||
Subproject commit 40b37e8f08bede2cb15f0b2fc5c639823c59b40e
|
Loading…
Reference in New Issue
Block a user