Axios Interceptor Refresh Call has Undefined Response

Hello,

I have created the below interceptor as a plugin in for my NuxtJS application.

It successfully $posts to my auth/refresh endpoint and has a response body with status 200 (as I can see in the network tab of my debugger tools).

However when I attempt to dump the tokenResponse it is undefined.

Is somebody able to shed light as to why this is occuring?

export default ({app}) => {
  app.$axios.interceptors.response.use(
    undefined,
    async (error) => {
      let res = error.response;

      if (res.status !== 401) {
        return error
      }

      app.$axios.$post('auth/refresh')
        .then(tokenResponse => {
          console.log(tokenResponse);
          let token = 'Bearer ' + tokenResponse.data.access_token;

          app.$auth.setToken('local', token);

          error.config.headers.Authorization = token;

          return app.$axios(error.config);
        })
        .catch((tokenError) => {
          app.$auth.reset();

          return error;
        })
    }
  )
}