zitejs 0.9.79 → 0.9.81
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/cjs/auth/index.d.ts +19 -0
- package/dist/cjs/auth/index.js +6 -0
- package/dist/cjs/sync/lib.js +1 -0
- package/dist/esm/auth/index.d.ts +19 -0
- package/dist/esm/auth/index.js +5 -0
- package/dist/esm/sync/lib.js +1 -0
- package/package.json +1 -1
package/dist/cjs/auth/index.d.ts
CHANGED
|
@@ -247,6 +247,25 @@ export declare function loginWithRedirect(opts?: {
|
|
|
247
247
|
export declare function logout(opts?: {
|
|
248
248
|
returnTo?: string;
|
|
249
249
|
}): void;
|
|
250
|
+
export declare function updateProfile(data: {
|
|
251
|
+
name?: string;
|
|
252
|
+
firstName?: string;
|
|
253
|
+
lastName?: string;
|
|
254
|
+
image?: string;
|
|
255
|
+
}): Promise<{
|
|
256
|
+
data: {
|
|
257
|
+
status: boolean;
|
|
258
|
+
};
|
|
259
|
+
error: null;
|
|
260
|
+
} | {
|
|
261
|
+
data: null;
|
|
262
|
+
error: {
|
|
263
|
+
code?: string | undefined | undefined;
|
|
264
|
+
message?: string | undefined | undefined;
|
|
265
|
+
status: number;
|
|
266
|
+
statusText: string;
|
|
267
|
+
};
|
|
268
|
+
}>;
|
|
250
269
|
export type User = {
|
|
251
270
|
id: string;
|
|
252
271
|
name: string;
|
package/dist/cjs/auth/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.signUp = exports.signOut = exports.signIn = exports.useSession = void 0;
|
|
4
4
|
exports.loginWithRedirect = loginWithRedirect;
|
|
5
5
|
exports.logout = logout;
|
|
6
|
+
exports.updateProfile = updateProfile;
|
|
6
7
|
const react_1 = require("better-auth/react");
|
|
7
8
|
const plugins_1 = require("better-auth/client/plugins");
|
|
8
9
|
const authClient = (0, react_1.createAuthClient)({
|
|
@@ -11,6 +12,8 @@ const authClient = (0, react_1.createAuthClient)({
|
|
|
11
12
|
});
|
|
12
13
|
exports.useSession = authClient.useSession, exports.signIn = authClient.signIn, exports.signOut = authClient.signOut, exports.signUp = authClient.signUp;
|
|
13
14
|
function loginWithRedirect(opts) {
|
|
15
|
+
if (window.location.pathname.startsWith('/auth/'))
|
|
16
|
+
return;
|
|
14
17
|
const params = new URLSearchParams();
|
|
15
18
|
if (opts?.redirectUrl)
|
|
16
19
|
params.set('redirectUrl', opts.redirectUrl);
|
|
@@ -24,3 +27,6 @@ function logout(opts) {
|
|
|
24
27
|
window.location.href = opts?.returnTo || '/';
|
|
25
28
|
});
|
|
26
29
|
}
|
|
30
|
+
function updateProfile(data) {
|
|
31
|
+
return authClient.updateUser(data);
|
|
32
|
+
}
|
package/dist/cjs/sync/lib.js
CHANGED
package/dist/esm/auth/index.d.ts
CHANGED
|
@@ -247,6 +247,25 @@ export declare function loginWithRedirect(opts?: {
|
|
|
247
247
|
export declare function logout(opts?: {
|
|
248
248
|
returnTo?: string;
|
|
249
249
|
}): void;
|
|
250
|
+
export declare function updateProfile(data: {
|
|
251
|
+
name?: string;
|
|
252
|
+
firstName?: string;
|
|
253
|
+
lastName?: string;
|
|
254
|
+
image?: string;
|
|
255
|
+
}): Promise<{
|
|
256
|
+
data: {
|
|
257
|
+
status: boolean;
|
|
258
|
+
};
|
|
259
|
+
error: null;
|
|
260
|
+
} | {
|
|
261
|
+
data: null;
|
|
262
|
+
error: {
|
|
263
|
+
code?: string | undefined | undefined;
|
|
264
|
+
message?: string | undefined | undefined;
|
|
265
|
+
status: number;
|
|
266
|
+
statusText: string;
|
|
267
|
+
};
|
|
268
|
+
}>;
|
|
250
269
|
export type User = {
|
|
251
270
|
id: string;
|
|
252
271
|
name: string;
|
package/dist/esm/auth/index.js
CHANGED
|
@@ -6,6 +6,8 @@ const authClient = createAuthClient({
|
|
|
6
6
|
});
|
|
7
7
|
export const { useSession, signIn, signOut, signUp } = authClient;
|
|
8
8
|
export function loginWithRedirect(opts) {
|
|
9
|
+
if (window.location.pathname.startsWith('/auth/'))
|
|
10
|
+
return;
|
|
9
11
|
const params = new URLSearchParams();
|
|
10
12
|
if (opts?.redirectUrl)
|
|
11
13
|
params.set('redirectUrl', opts.redirectUrl);
|
|
@@ -19,3 +21,6 @@ export function logout(opts) {
|
|
|
19
21
|
window.location.href = opts?.returnTo || '/';
|
|
20
22
|
});
|
|
21
23
|
}
|
|
24
|
+
export function updateProfile(data) {
|
|
25
|
+
return authClient.updateUser(data);
|
|
26
|
+
}
|
package/dist/esm/sync/lib.js
CHANGED