Something went wrong. Try again.
A simple to-do app focused on tasks that can be completed within a specific time span. taskline.tobinio.dev
Something went wrong. Try again.
TypeScript
at rust-backend
12345678910111213141516171819202122232425export default defineNuxtPlugin(async () => { const config = useRuntimeConfig();
const { getToken } = useAuthToken();
const api = $fetch.create({ baseURL: config.public.apiBase,
async onRequest({ options }) { const token = await getToken();
if (token) { options.headers = new Headers(options.headers); options.headers.set("Authorization", `Bearer ${token}`); } }, });
return { provide: { api, }, };});