fix: set cookie when login with phone

master
njzy 4 years ago
parent 2998e52427
commit c1c379098f

@ -160,12 +160,7 @@ export default {
password: "fakePassword", password: "fakePassword",
md5_password: md5(this.password).toString(), md5_password: md5(this.password).toString(),
}) })
.then((data) => { .then(this.handleLoginResponse)
if (data.code !== 502) {
this.updateData({ key: "user", value: data.profile });
this.afterLogin();
}
})
.catch((error) => { .catch((error) => {
this.processing = false; this.processing = false;
alert(error); alert(error);
@ -177,7 +172,18 @@ export default {
password: "fakePassword", password: "fakePassword",
md5_password: md5(this.password).toString(), md5_password: md5(this.password).toString(),
}) })
.then((data) => { .then(this.handleLoginResponse)
.catch((error) => {
this.processing = false;
alert(error);
});
}
},
handleLoginResponse(data) {
if (!data) {
this.processing = false;
return;
}
// MUSIC_U cookie // MUSIC_U cookie
// 301 // 301
const MUSIC_U = getMusicU(data.cookie); const MUSIC_U = getMusicU(data.cookie);
@ -186,12 +192,6 @@ export default {
this.updateData({ key: "user", value: data.profile }); this.updateData({ key: "user", value: data.profile });
this.afterLogin(); this.afterLogin();
} }
})
.catch((error) => {
this.processing = false;
alert(error);
});
}
}, },
}, },
}; };

Loading…
Cancel
Save