How to use the immutadot.unset function in immutadot

To help you get started, we’ve selected a few immutadot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpetetot / conference-hall / src / store / reactions / talks.js View on Github external
export const updateSpeakerToTalk = async (action, store) => {
  const { uid, talkId } = action.payload
  const talk = store.data.talks.get(talkId)
  if (talk) {
    let updated
    if (action.type === '@@ui/ADD_SPEAKER_TO_TALK') {
      updated = set(talk, `speakers.${uid}`, true)
    } else if (action.type === '@@ui/REMOVE_SPEAKER_TO_TALK') {
      updated = unset(talk, `speakers.${uid}`)
    }
    if (updated && Object.keys(updated.speakers).length > 0) {
      await talkCrud.update(updated)
      store.data.talks.update(updated)
    }
  }
}
github bpetetot / conference-hall / src / store / reactions / organizations.js View on Github external
export const removeMember = async (action, store, { router }) => {
  const { uid, organizationId } = action.payload
  const organization = store.data.organizations.get(organizationId)
  const updated = unset(organization, `members.${uid}`)
  await organizationCrud.update(updated)
  store.data.organizations.update(updated)
  router.push('organizer-organization-page', { organizationId })
}