mediahub-fe/service/auth.ts

38 lines
959 B
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);
}