Skip to content

Using router.push in file axios (in files vue I can use) #10731

Discussion options

You must be logged in to vote

@MilosPaunovic
Now, I think I got the hang of it.

For those who are going to use the axios interceptor, here is a tip:

import { boot } from 'quasar/wrappers'
import axios from "axios"
import { getCookie } from "../helpers/cookie"

const api = axios.create({ baseURL: 'URL' })
api.defaults.headers.common['Accept'] = 'application/json';
api.defaults.headers.common['Content-Type'] = 'application/json';
api.defaults.headers.common['Authorization'] = `Bearer ${getCookie('tkadm_pedds')}`;

export default boot(({ app, router }) => {
    api.interceptors.request.use(function (config) {
        return config;
    }, function (error) {
        return Promise.reject(error);
    });
    
    api.inter…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@EwertonDutra
Comment options

@EwertonDutra
Comment options

Comment options

You must be logged in to vote
1 reply
@dkwktm45
Comment options

Answer selected by EwertonDutra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants