feat: create by site

This commit is contained in:
MoreStrive
2024-07-15 21:02:22 +07:00
parent 043f97743c
commit 7565a37d60
9 changed files with 83 additions and 31 deletions
+5 -4
View File
@@ -17,12 +17,13 @@ export type Author = {
export const fetchByCode = async (event: H3Event) => {
try {
const { apiUrl } = useRuntimeConfig().public
const { authorCode }: any = getQuery(event)
const { authorCode }: any = getQuery(event);
const query = getQuery(event)
const { items }: any = await $fetch(`${apiUrl}/cms/author/code:${authorCode}`, {
method: 'GET',
headers: {
site: 1
}
headers: new Headers({
site: getSite(query.site).toString(),
}),
})
return items[0]
} catch (error) {