mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-27 14:38:52 +00:00
fix discord-link request body being empty
there was a double `toUrlSearchParams()` call involved
This commit is contained in:
parent
673624ae76
commit
30b6d4e6ff
@ -40,7 +40,7 @@ export abstract class ApiBase {
|
|||||||
headers["Content-Type"] = "application/json";
|
headers["Content-Type"] = "application/json";
|
||||||
} else if (dataType === "form-urlencoded") {
|
} else if (dataType === "form-urlencoded") {
|
||||||
if (bodyData instanceof Object) {
|
if (bodyData instanceof Object) {
|
||||||
body = new URLSearchParams(Object.entries<any>(bodyData).map(([ k, v ]) => [ k, v.toString() ])).toString();
|
body = this.toUrlSearchParams(bodyData).toString();
|
||||||
} else {
|
} else {
|
||||||
console.warn("Could not add body data to form-urlencoded!", bodyData);
|
console.warn("Could not add body data to form-urlencoded!", bodyData);
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,7 @@ export class PokerogueAdminApi extends ApiBase {
|
|||||||
*/
|
*/
|
||||||
public async linkAccountToDiscord(params: LinkAccountToDiscordIdRequest) {
|
public async linkAccountToDiscord(params: LinkAccountToDiscordIdRequest) {
|
||||||
try {
|
try {
|
||||||
const urlSearchParams = this.toUrlSearchParams(params);
|
const response = await this.doPost("/admin/account/discord-link", params, "form-urlencoded");
|
||||||
const response = await this.doPost("/admin/account/discord-link", urlSearchParams, "form-urlencoded");
|
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user