From 0036deb72e19489d33f9fadadb8364974f580688 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Tue, 13 Apr 2021 14:09:22 +0100 Subject: [PATCH] Apply `redirectUnauthorized: false` when saving roles - There's situations where the user does not have permision to create certain rules - In those cases ensure we don't log the user out --- components/auth/RoleDetailEdit.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/auth/RoleDetailEdit.vue b/components/auth/RoleDetailEdit.vue index f4bbc2ae0e..85943f0606 100644 --- a/components/auth/RoleDetailEdit.vue +++ b/components/auth/RoleDetailEdit.vue @@ -245,6 +245,18 @@ export default { cancel() { this.done(); }, + async actuallySave(url) { + if ( this.isCreate ) { + url = url || this.schema.linkFor('collection'); + const res = await this.value.save({ url, redirectUnauthorized: false }); + + if (res) { + Object.assign(this.value, res); + } + } else { + await this.value.save({ redirectUnauthorized: false }); + } + }, // Detail View verbKey(verb) { return `has${ ucFirst(verb) }`;