Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Hotfix: URLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem committed Jul 20, 2024
1 parent 156b867 commit 68fc1ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "r2r-js",
"version": "1.2.3",
"version": "1.2.4",
"description": "",
"main": "dist/index.js",
"browser": "dist/index.browser.js",
Expand Down
11 changes: 8 additions & 3 deletions src/r2rClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,14 @@ export class r2rClient {

@feature("login")
async login(email: string, password: string): Promise<LoginResponse> {
const formData = new URLSearchParams();
formData.append("username", email);
formData.append("password", password);
let formData;
if (typeof URLSearchParams !== "undefined") {
formData = new URLSearchParams();
formData.append("username", email);
formData.append("password", password);
} else {
formData = `username=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}`;
}

const response = await this._makeRequest<LoginResponse>("POST", "login", {
data: formData,
Expand Down

0 comments on commit 68fc1ff

Please sign in to comment.