first commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import {H3Event} from "h3";
|
||||
import Client from "~/utils/api/client";
|
||||
|
||||
export const ServerApi = (event: H3Event) => {
|
||||
const {apiUrl} = useRuntimeConfig().public;
|
||||
const accessToken = getCookie(event, 'Authorization');
|
||||
const refreshToken = getCookie(event, 'Refresh-Token');
|
||||
|
||||
console.log(`Access Token: ${accessToken}`);
|
||||
console.log(`Refresh Token: ${refreshToken}`);
|
||||
|
||||
const client = new Client(apiUrl as string, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
'Refresh-Token': `Bearer ${refreshToken}`
|
||||
} as HeadersInit
|
||||
})
|
||||
return client;
|
||||
}
|
||||
Reference in New Issue
Block a user