Skip to content

Instantly share code, notes, and snippets.

View kathisai's full-sized avatar
💻
Focusing on open source

Kathi sai prathap reddy kathisai

💻
Focusing on open source
View GitHub Profile
@mariocesar
mariocesar / api.js
Created September 26, 2017 04:21
Axios single configured instance
import axios from "axios";
const singleton = Symbol();
const singletonEnforcer = Symbol();
function readCookie(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
}
@paulsturgess
paulsturgess / service.js
Last active March 15, 2026 18:46
An example Service class wrapper for Axios
import axios from 'axios';
class Service {
constructor() {
let service = axios.create({
headers: {csrf: 'token'}
});
service.interceptors.response.use(this.handleSuccess, this.handleError);
this.service = service;
}