( data: Pick<Contact, 'first' | 'last' | 'twitter' | 'avatar' | 'notes'>, )
| 47 | } |
| 48 | |
| 49 | export async function createContact( |
| 50 | data: Pick<Contact, 'first' | 'last' | 'twitter' | 'avatar' | 'notes'>, |
| 51 | ) { |
| 52 | await fakeNetwork() |
| 53 | let id = Math.random().toString(36).substring(2, 9) |
| 54 | let contact = { ...data, id, createdAt: Date.now(), favorite: false } |
| 55 | let contacts = await getContacts() |
| 56 | contacts.unshift(contact) |
| 57 | await set(contacts) |
| 58 | return contact |
| 59 | } |
| 60 | |
| 61 | export async function getContact(id: string) { |
| 62 | await fakeNetwork() |
no test coverage detected
searching dependent graphs…