shotgun-js
v0.0.4
Published
[docs](http://fish_yilan.gitee.io/shotgunjs)
Downloads
5
Readme
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"