• r

    rp

    1 year ago
    on the browse console, can you print out axios and show me the output?
  • a

    anujchhabria

    1 year ago
    yep
  • a

    anujchhabria

    1 year ago
    wrap() ​ "$delete": function () ​ "$get": function () ​ "$head": function () ​ "$options": function () ​ "$patch": function () ​ "$post": function () ​ "$put": function () ​ "$request": function () ​ CancelToken: function CancelToken(executor) ​ create: function create() ​ defaults: Object { baseURL: "http://127.0.0.1:8000/", timeout: 0, xsrfCookieName: "XSRF-TOKEN", … } ​ delete: function wrap() ​ get: function wrap() ​ getUri: function wrap() ​ head: function wrap() ​ interceptors: Object { request: {…}, response: {…} } ​ isCancel: function isCancel(value) ​ length: 0 ​ name: "wrap" ​ onError: function onError() ​ onRequest: function onRequest() ​ onRequestError: function onRequestError() ​ onResponse: function onResponse() ​ onResponseError: function onResponseError() ​ options: function wrap() ​ patch: function wrap() ​ post: function wrap() ​ prototype: Object { … } ​ put: function wrap() ​ request: function wrap() ​ setBaseURL: function setBaseURL() ​ setHeader: function setHeader() ​ setToken: function setToken() ​prototype: function () supertokens.js:9
  • a

    anujchhabria

    1 year ago
    Sorry, not formatted
  • r

    rp

    1 year ago
    so it has not added the interceptor
  • r

    rp

    1 year ago
    you have to make sure that you call
    makeSuper
    on all the instances of axios you use
  • r

    rp

    1 year ago
    ideally have it right below the import statement for axios
  • a

    anujchhabria

    1 year ago
    export default function ({ $axios, redirect }) { SuperTokensRequest.makeSuper($axios); console.log($axios) SuperTokensRequest.init({ refreshTokenUrl: "https://uat.reportcard.tech/api/web/session/refresh" }); $axios.onError(error => { const code = parseInt(error.response && error.response.status) if (code === 400) { redirect('/400') } }) }
  • a

    anujchhabria

    1 year ago
    logged this right below the makeSuper call
  • r

    rp

    1 year ago
    hmm