0.0.4 • Published 3 years ago
shotgun-js v0.0.4
ShotgunJS
- config in init file
const urlRoot = {
hostApi: "https://<replaceme>/api/v1",
};
SHOTGUN.interceptors.request.use((config) => {
config.url = urlRoot.hostApi + config.url;
return config;
});
SHOTGUN.interceptors.request.use(async (config) => {
// getAuth() should return accesstoken
const header = await getAuth()
config.headers["Authorization"] = header.Authorization
return config;
});
- Import in other files
import SHOTGUN from "shotgun-js"