Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
// 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
}
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 })
}