Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interceptors? #151

Closed
341 opened this issue Jan 15, 2020 · 1 comment
Closed

Interceptors? #151

341 opened this issue Jan 15, 2020 · 1 comment

Comments

@341
Copy link

341 commented Jan 15, 2020

how to add interceptors?

axios.interceptors.request.use((config) => {
        try {
            let token = localStorage.getItem('token');

            let locale = getGlobalLocale();

            if (token) {
                config.headers['Authorization'] = 'Bearer ' + token
            }
            if (locale.currency) {
                config.headers['currency'] = locale.currency;
            }

            return config;
        } catch (e) {
            // console.log(e);
        }

});
@simoneb
Copy link
Owner

simoneb commented Jan 15, 2020

@simoneb simoneb closed this as completed Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants