Add creator name, fix ordering
This commit is contained in:
parent
6f7f8b9401
commit
405f754e02
|
@ -89,7 +89,11 @@ export default function NewContract() {
|
||||||
const [contracts, setContracts] = useState<Contract[]>([])
|
const [contracts, setContracts] = useState<Contract[]>([])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (creator?.id) {
|
if (creator?.id) {
|
||||||
setContract({ ...contract, creatorId: creator.id })
|
setContract((contract) => ({
|
||||||
|
...contract,
|
||||||
|
creatorId: creator.id,
|
||||||
|
creatorName: creator.name,
|
||||||
|
}))
|
||||||
listContracts(creator?.id).then(setContracts)
|
listContracts(creator?.id).then(setContracts)
|
||||||
}
|
}
|
||||||
}, [creator?.id])
|
}, [creator?.id])
|
||||||
|
@ -97,7 +101,7 @@ export default function NewContract() {
|
||||||
async function saveContract() {
|
async function saveContract() {
|
||||||
await pushContract(contract)
|
await pushContract(contract)
|
||||||
// Update local contract list
|
// Update local contract list
|
||||||
setContracts([...contracts, { ...contract }])
|
setContracts([{ ...contract }, ...contracts])
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveField(field: keyof Contract) {
|
function saveField(field: keyof Contract) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user