version update to nuxt4
This commit is contained in:
parent
7f1770d442
commit
ef84942e38
41 changed files with 5134 additions and 4946 deletions
33
app/plugins/sitemap.ts
Normal file
33
app/plugins/sitemap.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import type Page from "~~/types/collection/page";
|
||||
import type Global from "~~/types/single/global";
|
||||
|
||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
const pageState = useState<Page[]>("sitemap_pages", () => []);
|
||||
|
||||
if (pageState.value.length == 0) {
|
||||
const { find } = useStrapi();
|
||||
const { data: page_res } = await useAsyncData(
|
||||
"sitemap_pages",
|
||||
() =>
|
||||
find<Page>("pages", {
|
||||
filters: {
|
||||
//@ts-ignore
|
||||
$or: [
|
||||
{
|
||||
ref_only_access: { $eq: false },
|
||||
},
|
||||
{
|
||||
ref_only_access: { $null: true },
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
{
|
||||
server: true,
|
||||
lazy: false,
|
||||
default: () => {},
|
||||
}
|
||||
);
|
||||
pageState.value = page_res.value?.data ?? [];
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue