Hello, I’m currently attempting to make use of the @8base-js-sdk/api package (v0.1.6) from npm and am experiencing an error when using the transformResponse property in the config.
I’m able to query and mutate with this lib perfectly fine without this property enabled, but I was hoping to be able to use it as it is part of the package and should work.
Below is the lib in its entirety as well as the error I’m receiving. Any help with this problem is appreciated.
import EightBaseApi from '@8base-js-sdk/api'
import { parseCookies } from 'nookies'
export const config = {
workspaceId: process.env.NEXT_PUBLIC_8BASE_ENVIRONMENT,
timeout: 1000,
headers: {
Authorization: `Bearer ${parseCookies().idToken}`
},
// API calls can be transformed before a request is sent using one or more transformation functions.
// All functions will execute in order and updated values get passed to the following function.
// Example of this concept below:
// transformRequest: [
// (next, data) => {
// next({
// ...data,
// variables: {
// data: {
// timestamp: fixedTimestamp
// }
// }
// })
// },
// (next, data) => {
// next({
// ...data
// // Something else!
// })
// }
// ]
// Successful API responses can be transformed before the promise is resolved.
// All functions will execute in order and updated values get passed to the following function.
// Example of this concept below:
transformResponse: [
(next, data) => {
next({
...data,
response: {
data: {
test: '123'
}
}
})
}
]
// Failed API requests can be captured when a response is recieved.
// Example of this concept below:
// catchErrors: {
// TokenExpiredError: (err, reRun) => {},
// default: (err, reRun) => {}
// }
}
export default new EightBaseApi(config)