Add revalidation for weapon stories and groups
This commit is contained in:
parent
a0706fd52f
commit
0420dc30a4
|
@ -0,0 +1,15 @@
|
||||||
|
query revalidationGetWeaponGroup($id: ID) {
|
||||||
|
weaponStoryGroup(id: $id) {
|
||||||
|
data {
|
||||||
|
attributes {
|
||||||
|
weapons(pagination: { limit: -1 }) {
|
||||||
|
data {
|
||||||
|
attributes {
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,8 @@ type RequestProps =
|
||||||
| StrapiPostContent
|
| StrapiPostContent
|
||||||
| StrapiRangedContent
|
| StrapiRangedContent
|
||||||
| StrapiVideo
|
| StrapiVideo
|
||||||
|
| StrapiWeaponGroup
|
||||||
|
| StrapiWeaponStory
|
||||||
| StrapiWebsiteInterface
|
| StrapiWebsiteInterface
|
||||||
| StrapiWiki;
|
| StrapiWiki;
|
||||||
|
|
||||||
|
@ -36,6 +38,21 @@ interface CustomRequest {
|
||||||
path: string;
|
path: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface StrapiWeaponStory extends StrapiEvent {
|
||||||
|
model: "weapon-story";
|
||||||
|
entry: {
|
||||||
|
slug: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StrapiWeaponGroup extends StrapiEvent {
|
||||||
|
model: "weapon-story-group";
|
||||||
|
entry: {
|
||||||
|
id: string;
|
||||||
|
slug: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
interface StrapiRangedContent extends StrapiEvent {
|
interface StrapiRangedContent extends StrapiEvent {
|
||||||
event: CRUDEvents;
|
event: CRUDEvents;
|
||||||
model: "ranged-content";
|
model: "ranged-content";
|
||||||
|
@ -311,6 +328,21 @@ const Revalidate = async (
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "weapon-story": {
|
||||||
|
paths.push(`/wiki/weapons/${body.entry.slug}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "weapon-story-group": {
|
||||||
|
const group = await sdk.revalidationGetWeaponGroup({
|
||||||
|
id: body.entry.id,
|
||||||
|
});
|
||||||
|
filterHasAttributes(group.weaponStoryGroup?.data?.attributes?.weapons?.data, [
|
||||||
|
"attributes.slug",
|
||||||
|
] as const).forEach((weapon) => paths.push(`/wiki/weapons/${weapon.attributes.slug}`));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "custom": {
|
case "custom": {
|
||||||
paths.push(`${body.path}`);
|
paths.push(`${body.path}`);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue