Sootzani/utils/commonApi.ts

51 lines
1.2 KiB
TypeScript

import axios from "axios";
import { CookieValueTypes } from "cookies-next";
// Get Category
export async function getCategory() {
const data = await axios.get("api/Common/Categories");
return data.data;
}
export async function getOrganizations() {
const data = await axios.get("api/Common/Organizations");
return data.data;
}
// Get Captcha
export async function getCaptcha() {
const data = await axios.get("api/Common/Captcha", { responseType: "blob" });
return data;
}
export async function getSliders() {
const data = await axios.get("api/Common/Sliders");
return data.data;
}
export async function getWebContents() {
const data = await axios.get("api/Common/Contents");
return data.data;
}
export async function getSingleWebContents(title: string) {
const data = await axios.get(`api/Common/Contents/${title}`);
return data.data;
}
// News
export async function getNews() {
const data = await axios.get("api/Common/News");
return data.data;
}
export async function getNewsById(id: number) {
const data = await axios.get(`api/Common/News/${id}`);
return data.data;
}
export async function getOptions() {
const data = await axios.get("/api/Common/Options");
return data.data;
}