(id: string, updates: Partial<Contact>)
| 67 | } |
| 68 | |
| 69 | export 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 | |
| 80 | export async function deleteContact(id: string) { |
| 81 | let contacts = await localforage.getItem<Contact[]>('contacts') |
no test coverage detected
searching dependent graphs…