Hi,
I write my own DTO (Data Transef Object) based on axios router. I need create an instance of my DTO client and set token per request/user on server and i want use that client on both (client and server).
import { Client } from '@caloriosa/dto'
// I need available request, document and app here (on server-side request and on client-side document)
let client = new Client({
url: "my.api.url",
token: req.cookies.token || document.cookies.token
}
app.$client = client;
So I have no idea where to create my client instance. I need avaliable $client in application on client and on server per request (because token, user identification).
Thanks.
PS: I can't use auth module or axios module, i written own DTO service and I need use it in my project.
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2157">#c2157</a>)</em></sub></div>