mediahub-fe/service/settings/settings.ts

150 lines
4.0 KiB
TypeScript

import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
} from "../http-config/http-interceptor-service";
export async function getCategories(page: number, region: any) {
const url = `media/categories/list?enablePage=1&page=${page}&size=10&sort=desc&sortBy=id&publishedLocation=${region}`;
return httpGetInterceptor(url);
}
export async function getCategoriesAll() {
const url = "media/categories/list?enablePage=0&size=100&sort=desc&sortBy=id";
return httpGetInterceptor(url);
}
export async function publishUnpublishCategory(id: number, status: string) {
const url = `media/categories/publish?id=${id}&status=${status}`;
return httpPostInterceptor(url);
}
export async function deleteCategory(id: number) {
const url = `media/categories/${id}`;
return httpDeleteInterceptor(url);
}
export async function getUserRoles() {
const url = "users/roles";
return httpGetInterceptor(url);
}
export async function getCategoryDetail(id: string) {
const url = `media/categories/${id}`;
return httpGetInterceptor(url);
}
export async function postCategory(data: any) {
const url = "media/categories";
const headers = {
"Content-Type": "multipart/form-data",
};
return httpPostInterceptor(url, data, headers);
}
export async function getPrivacy(id: string) {
const url = `general/privacy-policy/${id}`;
return httpGetInterceptor(url);
}
export async function savePrivacy(data: any) {
const url = "general/privacy-policy/save";
return httpPostInterceptor(url, data);
}
export async function listBanner() {
const url = "media/banner";
return httpGetInterceptor(url);
}
export async function listStaticBanner() {
const url = "media/static-banner";
return httpGetInterceptor(url);
}
export async function setStaticBanner(id: number) {
const url = `media/static-banner?id=${id}`;
return httpPostInterceptor(url);
}
export async function setBanner(id: number, status: boolean) {
const url = `media/banner?id=${id}&status=${status}`;
return httpPostInterceptor(url);
}
export async function getListFAQ() {
const url = "master/faq/list";
return httpGetInterceptor(url);
}
export async function postDataFAQ(data: any) {
const url = "master/faq";
return httpPostInterceptor(url, data);
}
export async function deleteDataFAQ(id: string) {
const url = `master/faq/${id}`;
return httpDeleteInterceptor(url);
}
export async function detailDataFAQ(id: string) {
const url = `master/faq/${id}`;
return httpGetInterceptor(url);
}
export async function getListFeedback() {
const url = "master/feedback/list";
return httpGetInterceptor(url);
}
// export async function getUserFeedbacks() {
// const url = 'feedback/list-all';
// return httpGetInterceptor({ url });
// }
export async function detailDataFeedback(id: string) {
const url = `master/feedback/${id}`;
return httpGetInterceptor(url);
}
export async function postDataFeedback(data: any) {
const url = "master/feedback";
return httpPostInterceptor(url, data);
}
export async function deleteDataFeedback(id: string | number) {
const url = `master/feedback/${id}`;
return httpDeleteInterceptor(url);
}
export async function getTags() {
const url = "media/tags/list";
return httpGetInterceptor(url);
}
export async function getTagsBySubCategoryId(subCategory: string | number) {
const url = `media/tags/list?subCategoryId=${subCategory}`;
return httpGetInterceptor(url);
}
export async function getTagsByParentId(parentId: string | number) {
const url = `media/tags/list?categoryId=${parentId}`;
return httpGetInterceptor(url);
}
export async function postAdvertisements(data: any) {
const url = "advertisements";
const headers = {
"Content-Type": "multipart/form-data",
};
return httpPostInterceptor(url, data, headers);
}
export async function detailAdvertisements(id: any) {
const url = `advertisements?id=${id}`;
return httpGetInterceptor(url);
}
export async function deleteAdvertisements(id: string | number) {
const url = `advertisements?id=${id}`;
return httpDeleteInterceptor(url);
}