Sootzani/utils/commonApi.ts

34 lines
715 B
TypeScript

import axios from "axios";
import { CookieValueTypes } from "cookies-next";
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
// Get Category
export async function getCategory({token}:{token: CookieValueTypes}) {
const data = await axios.get(
"api/Common/Categories",
{
headers: {
Authorization: `Bearer ${token}`
},
}
);
return data.data;
}
// Get Captcha
export async function getCaptcha({token}:{token: CookieValueTypes}) {
const data = await axios.get(
"api/Common/Captcha",
{
headers: {
Authorization: `Bearer ${token}`
},
}
);
console.log(data)
return data;
}