Files
NSG_PORTAL_V2/server/models/author.ts
T
Duong Truong Phong 3a7132ea98 phongdt:podcast
2024-05-31 15:32:58 +07:00

31 lines
740 B
TypeScript

import { utils } from "~/utils/utilities";
import Base from "./base";
import { H3Event } from "h3";
export type Author = {
id:number;
siteId:number;
userId:number;
title:string
code:string;
description?:string;
thumbnail?:string;
feature?:string;
type?:number;
}
export const fetchByCode = async (event: H3Event) => {
try {
const { apiUrl } = useRuntimeConfig().public
const { authorCode }: any = getQuery(event)
const { items }: any = await $fetch(`${apiUrl}/cms/author/code:${authorCode}`, {
method: 'GET',
headers: {
site: 1
}
})
return items[0]
} catch (error) {
handleError(error)
}
}