Merge pull request #54 from useplunk/dev-driaug-contact-update

Fix: Contact not properly resetting on load
This commit is contained in:
Dries Augustyns
2024-08-14 08:36:40 +02:00
committed by GitHub
@@ -89,7 +89,10 @@ export default function Index() {
return; return;
} }
reset(contact); reset({
email: contact.email,
subscribed: contact.subscribed,
});
dataReset({ dataReset({
data: Object.entries(JSON.parse(contact.data ? contact.data : "{}")).map(([key, value]) => ({ data: Object.entries(JSON.parse(contact.data ? contact.data : "{}")).map(([key, value]) => ({
value: { key, value }, value: { key, value },
@@ -133,7 +136,6 @@ export default function Index() {
toast.promise( toast.promise(
network.mock<Contact, typeof ContactSchemas.manage>(project.secret, "PUT", "/v1/contacts", { network.mock<Contact, typeof ContactSchemas.manage>(project.secret, "PUT", "/v1/contacts", {
id: contact.id,
...data, ...data,
data: dataObject, data: dataObject,
}), }),