Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const create = () => {
const api = apisauce.create({
baseURL: "/api",
})
createAuthRefreshInterceptor(api.axiosInstance, refreshAuthLogic(api))
api.addRequestTransform(request => {
if (!["/token/", "/token/verify/"].includes(request.url)) {
const jwtAccess = cookieValue("JWT_ACCESS")
if (jwtAccess) {
request.headers.Authorization = `Bearer ${jwtAccess}`
}
}
})
return {
createToken: createToken(api),
verifyToken: verifyToken(api),
getQueue: getQueue(api),
postFrontDeskEvent: postFrontDeskEvent(api),
getParticipants: getParticipants(api),
const create = () => {
const accessToken = localStorage.getItem("JWT_ACCESS")
const api = apisauce.create({
baseURL: "/api",
headers: { Authorization: `Bearer ${accessToken}` },
})
createAuthRefreshInterceptor(api.axiosInstance, refreshAuthLogic(api))
const getParticipants = async () => {
const response = await api.get("/participants/")
return response
}
return {
getParticipants,
}
}