Commit b90127c5 authored by Chunchi Che's avatar Chunchi Che

fix match in Chinese

parent e52bde55
Pipeline #23451 passed with stages
in 17 minutes and 29 seconds
......@@ -12,8 +12,7 @@ export async function match(
arena: string = "entertain",
): Promise<MatchInfo | undefined> {
const headers = {
Authorization:
"Basic " + btoa(encodeURIComponent(username) + ":" + extraId),
Authorization: "Basic " + customBase64Encode(username + ":" + extraId),
};
let response: Response | undefined = undefined;
const params = new URLSearchParams({
......@@ -38,3 +37,9 @@ export async function match(
return (await response?.json()) as MatchInfo;
}
function customBase64Encode(input: string): string {
const uint8Array = new TextEncoder().encode(input);
const base64String = btoa(String.fromCharCode(...uint8Array));
return base64String;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment