Skip to content

Instantly share code, notes, and snippets.

@xbits
xbits / axiosClient.es6.js
Last active March 4, 2020 10:53
Example axios client for devise_token_auth
/*
This is an example of how to set up an axios instance to work with devise_token_auth gem.
*/
import axios from 'axios';
// Add the token headers to every request
const addTokenHeaders = (request) => {
let tokenAuth = localStorage.tokenAuth;
if(tokenAuth) {