@base44/sdk 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -20,7 +20,7 @@ export declare function createClient(config: {
20
20
  auth: {
21
21
  me(): Promise<import("axios").AxiosResponse<any, any>>;
22
22
  updateMe(data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
23
- login(nextUrl: string): void;
23
+ redirectToLogin(nextUrl: string): void;
24
24
  logout(redirectUrl?: string): void;
25
25
  setToken(token: string, saveToStorage?: boolean): void;
26
26
  loginViaUsernamePassword(email: string, password: string, turnstileToken?: string): Promise<{
package/dist/client.js CHANGED
@@ -60,12 +60,12 @@ export function createClient(config) {
60
60
  try {
61
61
  const isAuthenticated = await auth.isAuthenticated();
62
62
  if (!isAuthenticated) {
63
- auth.login(window.location.href);
63
+ auth.redirectToLogin(window.location.href);
64
64
  }
65
65
  }
66
66
  catch (error) {
67
67
  console.error("Authentication check failed:", error);
68
- auth.login(window.location.href);
68
+ auth.redirectToLogin(window.location.href);
69
69
  }
70
70
  }, 0);
71
71
  }
@@ -23,7 +23,7 @@ export declare function createAuthModule(axios: AxiosInstance, appId: string, se
23
23
  * @param {string} nextUrl - URL to redirect to after successful login
24
24
  * @throws {Error} When not in a browser environment
25
25
  */
26
- login(nextUrl: string): void;
26
+ redirectToLogin(nextUrl: string): void;
27
27
  /**
28
28
  * Logout the current user
29
29
  * Removes the token from localStorage and optionally redirects to a URL or reloads the page
@@ -27,7 +27,7 @@ export function createAuthModule(axios, appId, serverUrl) {
27
27
  * @param {string} nextUrl - URL to redirect to after successful login
28
28
  * @throws {Error} When not in a browser environment
29
29
  */
30
- login(nextUrl) {
30
+ redirectToLogin(nextUrl) {
31
31
  // This function only works in a browser environment
32
32
  if (typeof window === "undefined") {
33
33
  throw new Error("Login method can only be used in a browser environment");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",