From 405f754e021d492375573a12357f179a0379b994 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Fri, 10 Dec 2021 00:45:32 -0800 Subject: [PATCH] Add creator name, fix ordering --- web/pages/contract/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/pages/contract/index.tsx b/web/pages/contract/index.tsx index f283c230..b164f6d0 100644 --- a/web/pages/contract/index.tsx +++ b/web/pages/contract/index.tsx @@ -89,7 +89,11 @@ export default function NewContract() { const [contracts, setContracts] = useState([]) useEffect(() => { if (creator?.id) { - setContract({ ...contract, creatorId: creator.id }) + setContract((contract) => ({ + ...contract, + creatorId: creator.id, + creatorName: creator.name, + })) listContracts(creator?.id).then(setContracts) } }, [creator?.id]) @@ -97,7 +101,7 @@ export default function NewContract() { async function saveContract() { await pushContract(contract) // Update local contract list - setContracts([...contracts, { ...contract }]) + setContracts([{ ...contract }, ...contracts]) } function saveField(field: keyof Contract) {