81 lines
2.4 KiB
TypeScript
81 lines
2.4 KiB
TypeScript
import qs from "qs";
|
|
import { getAPIDummy } from "./http-config/axiosCustom";
|
|
import { httpPost } from "./http-config/http-base-service";
|
|
import { httpGetInterceptor, httpGetInterceptorWithToken, httpPostInterceptor } from "./http-config/http-interceptor-service";
|
|
|
|
export async function login(data: any) {
|
|
const pathUrl = "signin";
|
|
const headers = {
|
|
"content-type": "application/x-www-form-urlencoded",
|
|
};
|
|
return httpPost(pathUrl, headers, qs.stringify(data));
|
|
}
|
|
|
|
export async function getProfile(token: any) {
|
|
const url = "users/info";
|
|
return httpGetInterceptorWithToken(url, token);
|
|
}
|
|
|
|
export async function getInfoProfile() {
|
|
const url = "users/info";
|
|
return httpGetInterceptor(url);
|
|
}
|
|
|
|
export async function setupPassword(data: any) {
|
|
const url = "setup-password";
|
|
return httpPostInterceptor(url, data);
|
|
}
|
|
|
|
export async function saveUser(data: any) {
|
|
const url = "users/save";
|
|
return httpPostInterceptor(url, data);
|
|
}
|
|
export async function saveInstitutes(data: any) {
|
|
const url = "public/users/save-institutes";
|
|
return httpPostInterceptor(url, data);
|
|
}
|
|
export async function postRegistration(data: any) {
|
|
const url = "public/users/save";
|
|
return httpPostInterceptor(url, data);
|
|
}
|
|
|
|
export async function getDataByNIK(reqid: any, nik: any) {
|
|
const url = `http://spitpolri.com/api/back_end/get_ktp?reqid=${reqid}&nik=${nik}`;
|
|
return getAPIDummy(url);
|
|
}
|
|
|
|
export async function listInstitusi(roleId: any) {
|
|
const url = `public/users/institutes?categoryRoleId=${roleId}`;
|
|
return httpGetInterceptor(url);
|
|
}
|
|
|
|
export async function listProvince() {
|
|
const url = "public/users/provinces";
|
|
return httpGetInterceptor(url);
|
|
}
|
|
|
|
export async function listCity(id: any) {
|
|
const url = `public/users/cities?provId=${id}`;
|
|
return httpGetInterceptor(url);
|
|
}
|
|
|
|
export async function listDistricts(id: any) {
|
|
const url = `public/users/districts?cityId=${id}`;
|
|
return httpGetInterceptor(url);
|
|
}
|
|
|
|
export async function getDataByNRP(reqid: any, nrp: any) {
|
|
const url = `http://spitpolri.com/api/back_end/get_nrp?reqid=${reqid}&nrp=${nrp}`;
|
|
return getAPIDummy(url);
|
|
}
|
|
|
|
export async function getDataJournalist(cert: any) {
|
|
const url = `public/users/search-journalist?cert=${cert}`;
|
|
return httpGetInterceptor({ url });
|
|
}
|
|
|
|
export async function getDataPersonil(nrp: any) {
|
|
const url = `public/users/search-personil?nrp=${nrp}`;
|
|
return httpGetInterceptor({ url });
|
|
}
|