How to use the immutadot.flow 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 / firebase / submission.js View on Github external
export const unsubmitTalk = async (talk, eventId) => {
  const db = firebase.firestore()
  const batch = db.batch()

  // remove submissions
  const updatedTalk = flow(unset(`submissions.${eventId}`), unset('state'))(talk)
  talksCrud.update(updatedTalk)

  // remove proposal from event
  removeProposal(eventId, talk.id)

  await batch.commit()
  return updatedTalk
}
github bpetetot / conference-hall / functions / direct / submission.js View on Github external
// get the user to fully preload the function
    await getUser(context.auth.uid)
    return Promise.resolve()
  }

  const event = await getEvent(eventId)

  const isCfpOpened = getCfpState({ event, userTimezone }) === 'opened'
  if (!isCfpOpened) {
    throw new functions.https.HttpsError(
      'failed-precondition',
      "Can't unsubmit, CFP is not opened anymore.",
    )
  }

  const updatedTalk = flow(unset(`submissions.${eventId}`), unset('state'))(talk)

  await updateTalk(updatedTalk.id, updatedTalk)

  await removeProposal(eventId, talk.id)

  return updatedTalk
}
github bpetetot / conference-hall / src / store / reactions / organizations.js View on Github external
export const create = async (action, store, { router }) => {
  const data = action.payload
  const { uid } = store.auth.get()
  const newUserOrganization = flow(set(`members.${uid}`, true), set('owner', uid))(data)

  store.ui.loaders.update({ isOrganizationSaving: true })
  const ref = await organizationCrud.create(newUserOrganization)
  store.ui.loaders.update({ isOrganizationSaving: false })

  store.data.organizations.add({ id: ref.id, ...newUserOrganization })
  router.push('organizer-organization-page', { organizationId: ref.id })
}