update
This commit is contained in:
23
src/lib/api/page.ts
Normal file
23
src/lib/api/page.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { apiFetch } from './client';
|
||||
|
||||
export type PageType =
|
||||
| 'category'
|
||||
| 'product-search'
|
||||
| 'product-detail'
|
||||
| 'product-hot'
|
||||
| 'article-home'
|
||||
| 'article-category'
|
||||
| 'article-detail'
|
||||
| '404';
|
||||
|
||||
interface ResolvePageTypeResponse {
|
||||
pageType: PageType;
|
||||
}
|
||||
|
||||
export async function getResolvedPageType(slug: string) {
|
||||
const result = await apiFetch<ResolvePageTypeResponse>(
|
||||
`/page-type?slug=${encodeURIComponent(slug)}`,
|
||||
);
|
||||
|
||||
return result.pageType;
|
||||
}
|
||||
Reference in New Issue
Block a user