import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"; const baseUrl = new URL(process.env.BACKEND_URL); const taskbarApi = createApi({ reducerPath: "taskbarApi", baseQuery: fetchBaseQuery({ baseUrl: baseUrl.href, prepareHeaders: (headers) => { const apiKey = process.env.BACKEND_API_KEY; if (apiKey) { headers.set("Authorization", `Api-Key ${apiKey}`); } return headers; }, }), endpoints: () => ({}), }); export default taskbarApi;