Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mutating to allow interaction #139

Merged
merged 1 commit into from
Jun 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion resources/js/components/GraphqlMutation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
data: () => ({
error: false,
mutated: false,
mutating: false,
initialVariables: {},
data: {},
}),
Expand All @@ -59,6 +60,7 @@
return this.$scopedSlots.default({
mutate: this.mutate,
mutated: this.mutated,
mutating: this.mutating,
error: this.error,
variables: this.data,
})
Expand All @@ -85,6 +87,7 @@

methods: {
async mutate() {
this.mutating = true
this.error = false

try {
Expand Down Expand Up @@ -142,6 +145,7 @@
}, 2500);

if (!this.redirect && this.notify.message) {
this.mutating = false
Notify(this.notify.message, this.notify.type ?? 'success')
}

Expand All @@ -151,10 +155,11 @@
Notify(this.notify.message, this.notify.type ?? 'success')
}, 1500)
}

this.mutating = false
Turbolinks.visit(this.redirect)
}
} catch (e) {
this.mutating = false
Notify(window.config.translations.errors.wrong, 'warning')
}
},
Expand Down