-
-
Notifications
You must be signed in to change notification settings - Fork 542
Open
Description
I used the following command to create a client with axios.
npx openapi-typescript-codegen --input src/swagger/v1.json --output ./src/apiClients/kineticLinkApi --client axios --name KineticLinkApiClient
I want to create a centralized instance of the client:
import { KineticLinkApiClient } from "@/apiClients/kineticLinkApi";
// When deploying, this should be the public URL of your Next.js app
const NEXTJS_API_BASE_URL = process.env.NODE_ENV === 'production'
? process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'YOUR_PRODUCTION_NEXTJS_URL'
: 'https://localhost:7047';
const kineticLinkApiClient = new KineticLinkApiClient({
BASE: NEXTJS_API_BASE_URL,
TOKEN: 'Static token is working' // HOW CAN I RETRIEVE A TOKEN FROM SERVER?
});
export default kineticLinkApiClient;
I do not understand how to dynamically fetch a token.
Metadata
Metadata
Assignees
Labels
No labels