MCPcopy Index your code
hub / github.com/TanStack/query / createContact

Function createContact

examples/react/react-router/src/contacts.ts:49–59  ·  view source on GitHub ↗
(
  data: Pick<Contact, 'first' | 'last' | 'twitter' | 'avatar' | 'notes'>,
)

Source from the content-addressed store, hash-verified

47}
48
49export 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
61export async function getContact(id: string) {
62 await fakeNetwork()

Callers 1

actionFunction · 0.90

Calls 4

fakeNetworkFunction · 0.85
getContactsFunction · 0.85
setFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…