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";
|
||||
|
||||
const useApiFetch = async <T>(url: string, options?: any) => {
|
||||
// const { token } = useAuth();
|
||||
const { token } = useAuth();
|
||||
let head = {
|
||||
...(options?.headers || {}),
|
||||
};
|
||||
// if (token.value) {
|
||||
// head.Authorization = token.value;
|
||||
// }
|
||||
if (token.value) {
|
||||
head.Authorization = token.value;
|
||||
}
|
||||
/* const cached = useSessionStorage<T>(url, null, {
|
||||
serializer: StorageSerializers.object,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user