refactor(composables): update useApiFetch
composable
add authorization header
This commit is contained in:
parent
a5a3147365
commit
ec13656660
@ -1,13 +1,13 @@
|
|||||||
import { AsyncData } from "#app";
|
import { AsyncData } from "#app";
|
||||||
|
|
||||||
const useApiFetch = async <T>(url: string, options?: any) => {
|
const useApiFetch = async <T>(url: string, options?: any) => {
|
||||||
// const { token } = useAuth();
|
const { token } = useAuth();
|
||||||
let head = {
|
let head = {
|
||||||
...(options?.headers || {}),
|
...(options?.headers || {}),
|
||||||
};
|
};
|
||||||
// if (token.value) {
|
if (token.value) {
|
||||||
// head.Authorization = token.value;
|
head.Authorization = token.value;
|
||||||
// }
|
}
|
||||||
/* const cached = useSessionStorage<T>(url, null, {
|
/* const cached = useSessionStorage<T>(url, null, {
|
||||||
serializer: StorageSerializers.object,
|
serializer: StorageSerializers.object,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user