@@ -5,20 +5,18 @@ import type { BagelUser } from '@bageldb/bagel-db/src/interfaces';
55// import type { AxiosResponse } from 'axios';
66import { parse , serialize } from './cookies' ;
77import type { AxiosResponse } from 'axios' ;
8- // import axios from 'axios';
8+ import axios from 'axios' ;
99
1010const AUTH_ENDPOINT = 'https://auth.bageldb.com/api/public' ;
1111
1212// let axios: AxiosStatic;
1313// import('axios').then((axiosModule) => {
1414// axios = axiosModule.default;
1515// });
16- let axiosImportPath : string ;
17- if ( process . client ) {
18- axiosImportPath = 'axios/dist/esm/axios'
19- } else {
20- axiosImportPath = 'axios'
21- }
16+ // if (process.client) {
17+ // } else {
18+ // axios = require('axios').default;
19+ // }
2220
2321class BagelNuxtUser extends BagelUsersRequest {
2422 constructor ( { instance } : { instance : any } ) {
@@ -151,15 +149,10 @@ export default class BagelNuxt extends BagelDB {
151149 super ( apiToken )
152150 this . ctx = ctx ;
153151
152+ // @ts -expect-error
153+ this . axiosInstance = axios . create ( ) ;
154154
155-
156- import ( axiosImportPath ) . then ( ( axiosModule ) => {
157- this . axiosInstance = axiosModule . default . create ( {
158- maxContentLength : Infinity ,
159- maxBodyLength : Infinity ,
160- } ) ;
161-
162- this . axiosInstance
155+ this . axiosInstance
163156 . interceptors
164157 . request
165158 . use (
@@ -194,7 +187,7 @@ export default class BagelNuxt extends BagelDB {
194187 const config = error . config ;
195188 config . headers [ "Authorization" ] = `Bearer ${ new BagelNuxtUser ( { instance : this } ) . _getAccessToken ( ) } ` ;
196189 return new Promise ( ( resolve , reject ) => {
197- axiosModule . default . request ( config )
190+ axios . request ( config )
198191 . then ( ( response : unknown ) => {
199192 resolve ( response ) ;
200193 } )
@@ -208,7 +201,6 @@ export default class BagelNuxt extends BagelDB {
208201 }
209202 return Promise . reject ( error ) ;
210203 } ) ;
211- } ) ;
212204 }
213205 // @ts -expect-error
214206 users ( ) {
0 commit comments