20 lines
572 B
TypeScript
20 lines
572 B
TypeScript
import axios from "axios";
|
|
import { CookieValueTypes, getCookie } from "cookies-next";
|
|
|
|
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
|
|
|
axios.interceptors.request.use(function (config) {
|
|
const token = getCookie("Sootzani_Admin_Token");
|
|
config.headers.Authorization = token ? `Bearer ${token}` : "";
|
|
return config;
|
|
});
|
|
|
|
export async function getInfoList() {
|
|
const data = await axios.get("api/Info/List");
|
|
return data.data;
|
|
}
|
|
export async function getInfo(id: string = "0") {
|
|
const data = await axios.get(`api/Info/${id}`);
|
|
return data.data;
|
|
}
|