const Header = {
token: LocalStorage.getItem("token"),
};
const PATH_BASE = "";
class DynamicAPI {
constructor() {
this.header = Header;
this.pathBase = PATH_BASE
}
request = ({path, method, body}) => {
return fetch(this.pathBase + path, {
method: method,
headers: this.header,
body: body
}).then((response) => {
})
};
get = ({path}) => {
return this.request({path, method: "GET", body: null})
};
post = ({path, body}) => {
}
}
export default new DynamicAPI();
const AuthService = {
login: async (email, password) => {
const res = await DynamicAPI.post({path: "/login", body: {email, password}})
},
logout: () => {
}
};
const APIService = {
getListStaff: () => {
return DynamicAPI.get({path: '/staff'})
}
};