How to use the @vue/apollo-composable.useMutation function in @vue/apollo-composable

To help you get started, we’ve selected a few @vue/apollo-composable 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 metaspace2020 / metaspace / metaspace / webapp / src / modules / MolecularDatabases / DatabaseDetailsView.tsx View on Github external
}
    })

    const state = reactive({
      showNewVersionDialog: false,
    })

    const handleNewVersionClose = () => { state.showNewVersionDialog = false }
    const handleNewVersionDone = () => {
      handleNewVersionClose()
      props.close()
    }

    const {
      mutate: updateDatabase,
    } = useMutation(updateDatabaseDetailsMutation)

    // hacking
    const submit = updateDatabase as unknown as (update: UpdateDatabaseDetailsMutation) => void

    const submitAndRefetch = async(details: MolecularDB) => {
      await submit({
        id: props.id,
        details,
      })
      await refetch()
    }

    return () => {
      let content

      if (result.value === undefined) {
github metaspace2020 / metaspace / metaspace / webapp / src / modules / MolecularDatabases / DeleteDatabaseForm.tsx View on Github external
setup(props, { root, emit }) {
    const { mutate } = useMutation(deleteDatabaseMutation)
    const deleteDatabase = mutate as unknown as (variables: DeleteDatabaseMutation) => void

    const formattedName = formatDatabaseLabel(props.db)

    const handleDelete = () => {
      confirmPrompt({
        title: '',
        message: `Are you sure you want to delete ${formattedName}?`,
        confirmButtonText: 'Delete',
        confirmButtonLoadingText: 'Deleting...',
      }, async() => {
        try {
          await deleteDatabase({ id: props.db.id })
          root.$message({ message: `${formattedName} deleted`, type: 'success' })
          emit('deleted')
        } catch (e) {

@vue/apollo-composable

Apollo GraphQL for Vue Composition API

MIT
Latest version published 28 days ago

Package Health Score

94 / 100
Full package analysis