mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-19 07:20:57 +00:00
migrate unlink google to pokerogue-api
This commit is contained in:
parent
8ac7ad4221
commit
8fa0d82a6c
@ -377,14 +377,33 @@ export class PokerogueApi extends Api {
|
||||
*/
|
||||
public async unlinkDiscord() {
|
||||
try {
|
||||
const response = await this.doPost("/unlink/discord");
|
||||
const response = await this.doPost("/auth/discord/logout");
|
||||
if (response.ok) {
|
||||
return true;
|
||||
} else {
|
||||
console.warn(`Unlink failed (${response.status}: ${response.statusText})`);
|
||||
console.warn(`Discord unlink failed (${response.status}: ${response.statusText})`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Could not unlink discord!", err);
|
||||
console.warn("Could not unlink Discord!", err);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink the currently logged in user from Google.
|
||||
* @returns `true` if unlinking was successful, `false` if not
|
||||
*/
|
||||
public async unlinkGoogle() {
|
||||
try {
|
||||
const response = await this.doPost("/auth/google/logout");
|
||||
if (response.ok) {
|
||||
return true;
|
||||
} else {
|
||||
console.warn(`Google Unlink failed (${response.status}: ${response.statusText})`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Could not unlink Google!", err);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -532,10 +532,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
||||
window.open(googleUrl, "_self");
|
||||
return true;
|
||||
} else {
|
||||
Utils.apiPost("/auth/google/logout", undefined, undefined, true).then(res => {
|
||||
if (!res.ok) {
|
||||
console.error(`Unlink failed (${res.status}: ${res.statusText})`);
|
||||
}
|
||||
pokerogueApi.unlinkGoogle().then(_isSuccess => {
|
||||
updateUserInfo().then(() => this.scene.reset(true, true));
|
||||
});
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user