44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import axios from "axios";
|
|
import { CookieValueTypes, getCookie } from "cookies-next";
|
|
|
|
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
|
// axios.defaults.baseURL = "https://shahrbinapi.shetabdahi.ir/";
|
|
|
|
axios.interceptors.request.use(function (config) {
|
|
const token = getCookie("Shahrbin_Token");
|
|
config.headers.Authorization = token ? `Bearer ${token}` : "";
|
|
return config;
|
|
});
|
|
|
|
// Get Location
|
|
export async function getLocations() {
|
|
const data = await axios.get(`/api/CitizenReport/Locations?instanceId=1`, {
|
|
});
|
|
return data.data;
|
|
}
|
|
|
|
// ResendOtp
|
|
export async function resendOtp(payload: { otpToken: string | any}) {
|
|
const data = await axios.post(
|
|
`/api/Authenticate/ResendOtp`,
|
|
payload
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
|
|
// Get CitizenReport
|
|
export async function getCitizenReport({
|
|
PageNumber = 1,
|
|
PageSize = 10,
|
|
instanceId = 1,
|
|
}: {
|
|
PageNumber?: number;
|
|
PageSize?: number;
|
|
instanceId?:number;
|
|
}) {
|
|
const data = await axios.get(`/api/CitizenReport?instanceId=${instanceId}&PageNumber=${PageNumber}&PageSize=${PageSize}`, {
|
|
});
|
|
return data.data;
|
|
}
|