Skip to content

Instantly share code, notes, and snippets.

View Hossein-rezaei's full-sized avatar

Hossein Rezaei Hossein-rezaei

View GitHub Profile
@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;
}
@moreta
moreta / http.js
Last active September 5, 2023 15:27
axios interceptor sample code
/**
* src/api/http.js
*/
import axios from 'axios'
import qs from 'qs'
/**
*
* parse error response
*/