X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FUpsertUser.vue;h=dc948cf1a4976ccf423e5362fd5d597e27e9828b;hb=54ec15ebc0cc874cb40307d0d674964b2f0e11a4;hp=ac15324c213496e646701424795755a2fe605b44;hpb=09d375717c256a2cbd71a5d3b3a4e21aee17c0ec;p=vchess.git diff --git a/client/src/components/UpsertUser.vue b/client/src/components/UpsertUser.vue index ac15324c..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) { @@ -142,7 +147,7 @@ export default { case "Login": return "Connection token sent. Check your emails!"; case "Register": - return "Registration complete! Please check your emails"; + return "Registration complete! Please check your emails now"; case "Update": return "Modifications applied!"; } @@ -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); } ); },