- ajax(this.ajaxUrl(), this.ajaxMethod(),
- this.stage == "Login" ? { nameOrEmail: this.nameOrEmail } : this.user,
- res => {
-
- console.log("receive login infos");
- console.log(res);
-
- this.infoMsg = this.infoMessage();
- if (this.stage != "Update")
- {
- this.nameOrEmail = "";
- this.user["email"] = "";
- this.user["name"] = "";
-
- debugger; //TODO: 2 passages ici au lieu d'1 lors du register
-
- // Store our identifiers in local storage (by little anticipation...)
- localStorage["myid"] = res.id;
- localStorage["myname"] = res.name;
- // Also in global object
- this.st.user.id = res.id;
- this.st.user.name = res.name;
- }
- setTimeout(() => {
+ ajax(
+ this.ajaxUrl(),
+ this.ajaxMethod(),
+ {
+ 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) => {