MCPcopy
hub / github.com/TanStack/query / updateContact

Function updateContact

examples/react/react-router/src/contacts.ts:69–78  ·  view source on GitHub ↗
(id: string, updates: Partial<Contact>)

Source from the content-addressed store, hash-verified

67}
68
69export async function updateContact(id: string, updates: Partial<Contact>) {
70 await fakeNetwork()
71 let contacts = await localforage.getItem<Contact[]>('contacts')
72 if (!contacts) return false
73 let contact = contacts.find((contact) => contact.id === id)
74 if (!contact) throw new Error(`No contact found for ${id}`)
75 Object.assign(contact, updates)
76 await set(contacts)
77 return contact
78}
79
80export async function deleteContact(id: string) {
81 let contacts = await localforage.getItem<Contact[]>('contacts')

Callers 2

actionFunction · 0.90
actionFunction · 0.90

Calls 3

fakeNetworkFunction · 0.85
setFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…