X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FUpsertUser.vue;h=dc948cf1a4976ccf423e5362fd5d597e27e9828b;hb=d54f6261c9e30f4eabb402ad301dd5c5e40fb656;hp=2be637c678d0c52331779dcde795f4d40587ca32;hpb=f0c68a04e31bb6a4b2f8b94a532ef3ca2eebbe3e;p=vchess.git diff --git a/client/src/components/UpsertUser.vue b/client/src/components/UpsertUser.vue index 2be637c6..dc948cf1 100644 --- a/client/src/components/UpsertUser.vue +++ b/client/src/components/UpsertUser.vue @@ -4,7 +4,7 @@ div type="checkbox" @change="trySetEnterTime($event)" ) - div( + div#upsertDiv( role="dialog" data-checkbox="modalUser" ) @@ -59,6 +59,7 @@ div import { store } from "@/store"; import { checkNameEmail } from "@/data/userCheck"; import { ajax } from "@/utils/ajax"; +import { processModalClick } from "@/utils/modalClick.js"; export default { name: "my-upsert-user", data: function() { @@ -71,6 +72,10 @@ export default { user: {} }; }, + mounted: function() { + document.getElementById("upsertDiv") + .addEventListener("click", processModalClick); + }, watch: { nameOrEmail: function(newValue) { if (newValue.indexOf("@") >= 0) { @@ -165,21 +170,26 @@ export default { ajax( this.ajaxUrl(), this.ajaxMethod(), - this.stage == "Login" - ? { nameOrEmail: this.nameOrEmail } - : this.user, - () => { - this.infoMsg = this.infoMessage(); - if (this.stage != "Update") this.nameOrEmail = ""; - else { - this.st.user.name = this.user.name; - this.st.user.email = this.user.email; - this.st.user.notify = this.user.notify; + { + credentials: true, + data: ( + this.stage == "Login" + ? { nameOrEmail: this.nameOrEmail } + : this.user + ), + success: () => { + this.infoMsg = this.infoMessage(); + if (this.stage != "Update") this.nameOrEmail = ""; + else { + this.st.user.name = this.user.name; + this.st.user.email = this.user.email; + this.st.user.notify = this.user.notify; + } + }, + error: (err) => { + this.infoMsg = ""; + alert(err); } - }, - err => { - this.infoMsg = ""; - alert(err); } ); },