Changes all documents to have an explicit type
This commit is contained in:
@@ -25,11 +25,10 @@ export const NewNpcForm = ({
|
||||
try {
|
||||
const npcDoc: Npc = await pb.collection("documents").create({
|
||||
campaign,
|
||||
type: "npc",
|
||||
data: {
|
||||
npc: {
|
||||
name,
|
||||
description,
|
||||
},
|
||||
name,
|
||||
description,
|
||||
},
|
||||
});
|
||||
setName("");
|
||||
|
||||
@@ -10,10 +10,7 @@ export const NpcEditForm = ({ npc }: { npc: Npc }) => {
|
||||
await pb.collection("documents").update(npc.id, {
|
||||
data: {
|
||||
...npc.data,
|
||||
npc: {
|
||||
...npc.data.npc,
|
||||
name,
|
||||
},
|
||||
name,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -22,10 +19,7 @@ export const NpcEditForm = ({ npc }: { npc: Npc }) => {
|
||||
await pb.collection("documents").update(npc.id, {
|
||||
data: {
|
||||
...npc.data,
|
||||
npc: {
|
||||
...npc.data.npc,
|
||||
description,
|
||||
},
|
||||
description,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -34,11 +28,11 @@ export const NpcEditForm = ({ npc }: { npc: Npc }) => {
|
||||
<div className="">
|
||||
<AutoSaveTextarea
|
||||
multiline={false}
|
||||
value={npc.data.npc.name}
|
||||
value={npc.data.name}
|
||||
onSave={saveNpcName}
|
||||
/>
|
||||
<AutoSaveTextarea
|
||||
value={npc.data.npc.description}
|
||||
value={npc.data.description}
|
||||
onSave={saveNpcDescription}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -6,8 +6,8 @@ import type { Npc } from "@/lib/types";
|
||||
export const NpcPrintRow = ({ npc }: { npc: Npc }) => {
|
||||
return (
|
||||
<li className="">
|
||||
<h4>{npc.data.npc.name}</h4>
|
||||
<p>{npc.data.npc.description}</p>
|
||||
<h4>{npc.data.name}</h4>
|
||||
<p>{npc.data.description}</p>
|
||||
</li>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user