@better-auth-ui/react 1.6.2 → 1.6.3
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/hooks/auth/use-authenticate.d.ts +30 -6
- package/dist/hooks/auth/use-is-username-available.d.ts +12 -11
- package/dist/hooks/auth/use-is-username-available.js +8 -7
- package/dist/hooks/auth/use-request-password-reset.d.ts +11 -15
- package/dist/hooks/auth/use-request-password-reset.js +8 -7
- package/dist/hooks/auth/use-reset-password.d.ts +13 -29
- package/dist/hooks/auth/use-reset-password.js +8 -7
- package/dist/hooks/auth/use-send-verification-email.d.ts +10 -14
- package/dist/hooks/auth/use-send-verification-email.js +8 -7
- package/dist/hooks/auth/use-session.d.ts +30 -4
- package/dist/hooks/auth/use-session.js +11 -10
- package/dist/hooks/auth/use-sign-in-email.d.ts +11 -37
- package/dist/hooks/auth/use-sign-in-email.js +11 -12
- package/dist/hooks/auth/use-sign-in-magic-link.d.ts +14 -18
- package/dist/hooks/auth/use-sign-in-magic-link.js +8 -7
- package/dist/hooks/auth/use-sign-in-passkey.d.ts +10 -47
- package/dist/hooks/auth/use-sign-in-passkey.js +11 -12
- package/dist/hooks/auth/use-sign-in-social.d.ts +30 -59
- package/dist/hooks/auth/use-sign-in-social.js +8 -7
- package/dist/hooks/auth/use-sign-in-username.d.ts +12 -40
- package/dist/hooks/auth/use-sign-in-username.js +11 -12
- package/dist/hooks/auth/use-sign-out.d.ts +10 -10
- package/dist/hooks/auth/use-sign-out.js +10 -12
- package/dist/hooks/auth/use-sign-up-email.d.ts +18 -101
- package/dist/hooks/auth/use-sign-up-email.js +11 -12
- package/dist/hooks/auth/use-user.d.ts +7 -5
- package/dist/hooks/settings/use-account-info.d.ts +9 -9
- package/dist/hooks/settings/use-account-info.js +13 -16
- package/dist/hooks/settings/use-add-passkey.d.ts +8 -30
- package/dist/hooks/settings/use-add-passkey.js +10 -11
- package/dist/hooks/settings/use-change-email.d.ts +11 -14
- package/dist/hooks/settings/use-change-email.js +11 -12
- package/dist/hooks/settings/use-change-password.d.ts +11 -43
- package/dist/hooks/settings/use-change-password.js +8 -7
- package/dist/hooks/settings/use-delete-passkey.d.ts +10 -12
- package/dist/hooks/settings/use-delete-passkey.js +11 -12
- package/dist/hooks/settings/use-delete-user.d.ts +13 -30
- package/dist/hooks/settings/use-delete-user.js +8 -7
- package/dist/hooks/settings/use-link-social.d.ts +22 -25
- package/dist/hooks/settings/use-link-social.js +8 -7
- package/dist/hooks/settings/use-list-accounts.d.ts +8 -6
- package/dist/hooks/settings/use-list-accounts.js +10 -16
- package/dist/hooks/settings/use-list-device-sessions.d.ts +29 -6
- package/dist/hooks/settings/use-list-device-sessions.js +10 -16
- package/dist/hooks/settings/use-list-sessions.d.ts +8 -5
- package/dist/hooks/settings/use-list-sessions.js +10 -16
- package/dist/hooks/settings/use-list-user-passkeys.d.ts +8 -5
- package/dist/hooks/settings/use-list-user-passkeys.js +10 -16
- package/dist/hooks/settings/use-revoke-multi-session.d.ts +11 -11
- package/dist/hooks/settings/use-revoke-multi-session.js +11 -12
- package/dist/hooks/settings/use-revoke-session.d.ts +11 -11
- package/dist/hooks/settings/use-revoke-session.js +11 -12
- package/dist/hooks/settings/use-set-active-session.d.ts +12 -29
- package/dist/hooks/settings/use-set-active-session.js +12 -13
- package/dist/hooks/settings/use-unlink-account.d.ts +12 -12
- package/dist/hooks/settings/use-unlink-account.js +11 -12
- package/dist/hooks/settings/use-update-user.d.ts +1178 -4
- package/dist/hooks/settings/use-update-user.js +17 -18
- package/dist/hooks/use-auth-mutation.d.ts +12 -0
- package/dist/hooks/use-auth-mutation.js +11 -0
- package/dist/hooks/use-auth-query.d.ts +14 -0
- package/dist/hooks/use-auth-query.js +15 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -33
- package/dist/mutations/auth/is-username-available-options.d.ts +19 -0
- package/dist/mutations/auth/is-username-available-options.js +7 -0
- package/dist/mutations/auth/request-password-reset-options.d.ts +15 -0
- package/dist/mutations/auth/request-password-reset-options.js +7 -0
- package/dist/mutations/auth/reset-password-options.d.ts +17 -0
- package/dist/mutations/auth/reset-password-options.js +7 -0
- package/dist/mutations/auth/send-verification-email-options.d.ts +15 -0
- package/dist/mutations/auth/send-verification-email-options.js +7 -0
- package/dist/mutations/auth/sign-in-email-options.d.ts +23 -0
- package/dist/mutations/auth/sign-in-email-options.js +11 -0
- package/dist/mutations/auth/sign-in-magic-link-options.d.ts +23 -0
- package/dist/mutations/auth/sign-in-magic-link-options.js +11 -0
- package/dist/mutations/auth/sign-in-passkey-options.d.ts +15 -0
- package/dist/mutations/auth/sign-in-passkey-options.js +11 -0
- package/dist/mutations/auth/sign-in-social-options.d.ts +61 -0
- package/dist/mutations/auth/sign-in-social-options.js +11 -0
- package/dist/mutations/auth/sign-in-username-options.d.ts +19 -0
- package/dist/mutations/auth/sign-in-username-options.js +11 -0
- package/dist/mutations/auth/sign-out-options.d.ts +12 -0
- package/dist/mutations/auth/sign-out-options.js +7 -0
- package/dist/mutations/auth/sign-up-email-options.d.ts +1180 -0
- package/dist/mutations/auth/sign-up-email-options.js +11 -0
- package/dist/mutations/auth-mutation-options.d.ts +25 -0
- package/dist/mutations/auth-mutation-options.js +19 -0
- package/dist/mutations/settings/add-passkey-options.d.ts +15 -0
- package/dist/mutations/settings/add-passkey-options.js +11 -0
- package/dist/mutations/settings/change-email-options.d.ts +15 -0
- package/dist/mutations/settings/change-email-options.js +7 -0
- package/dist/mutations/settings/change-password-options.d.ts +17 -0
- package/dist/mutations/settings/change-password-options.js +7 -0
- package/dist/mutations/settings/delete-passkey-options.d.ts +13 -0
- package/dist/mutations/settings/delete-passkey-options.js +11 -0
- package/dist/mutations/settings/delete-user-options.d.ts +20 -0
- package/dist/mutations/settings/delete-user-options.js +7 -0
- package/dist/mutations/settings/link-social-options.d.ts +39 -0
- package/dist/mutations/settings/link-social-options.js +7 -0
- package/dist/mutations/settings/revoke-multi-session-options.d.ts +13 -0
- package/dist/mutations/settings/revoke-multi-session-options.js +11 -0
- package/dist/mutations/settings/revoke-session-options.d.ts +13 -0
- package/dist/mutations/settings/revoke-session-options.js +7 -0
- package/dist/mutations/settings/set-active-session-options.d.ts +13 -0
- package/dist/mutations/settings/set-active-session-options.js +11 -0
- package/dist/mutations/settings/unlink-account-options.d.ts +15 -0
- package/dist/mutations/settings/unlink-account-options.js +7 -0
- package/dist/mutations/settings/update-user-options.d.ts +1182 -0
- package/dist/mutations/settings/update-user-options.js +7 -0
- package/dist/queries/auth/session-options.d.ts +110 -0
- package/dist/queries/auth/session-options.js +7 -0
- package/dist/queries/auth-query-options.d.ts +29 -0
- package/dist/queries/auth-query-options.js +17 -0
- package/dist/queries/settings/account-info-options.d.ts +32 -0
- package/dist/queries/settings/account-info-options.js +12 -0
- package/dist/queries/settings/list-accounts-options.d.ts +53 -0
- package/dist/queries/settings/list-accounts-options.js +12 -0
- package/dist/queries/settings/list-device-sessions-options.d.ts +99 -0
- package/dist/queries/settings/list-device-sessions-options.js +12 -0
- package/dist/queries/settings/list-sessions-options.d.ts +54 -0
- package/dist/queries/settings/list-sessions-options.js +12 -0
- package/dist/queries/settings/list-user-passkeys-options.d.ts +18 -0
- package/dist/queries/settings/list-user-passkeys-options.js +12 -0
- package/package.json +1 -1
- package/src/hooks/auth/use-authenticate.ts +7 -10
- package/src/hooks/auth/use-is-username-available.ts +17 -8
- package/src/hooks/auth/use-request-password-reset.ts +19 -8
- package/src/hooks/auth/use-reset-password.ts +19 -9
- package/src/hooks/auth/use-send-verification-email.ts +18 -8
- package/src/hooks/auth/use-session.ts +20 -16
- package/src/hooks/auth/use-sign-in-email.ts +23 -16
- package/src/hooks/auth/use-sign-in-magic-link.ts +18 -10
- package/src/hooks/auth/use-sign-in-passkey.ts +24 -18
- package/src/hooks/auth/use-sign-in-social.ts +18 -8
- package/src/hooks/auth/use-sign-in-username.ts +24 -18
- package/src/hooks/auth/use-sign-out.ts +18 -17
- package/src/hooks/auth/use-sign-up-email.ts +24 -18
- package/src/hooks/auth/use-user.ts +7 -8
- package/src/hooks/settings/use-account-info.ts +29 -20
- package/src/hooks/settings/use-add-passkey.ts +22 -17
- package/src/hooks/settings/use-change-email.ts +21 -17
- package/src/hooks/settings/use-change-password.ts +18 -8
- package/src/hooks/settings/use-delete-passkey.ts +21 -16
- package/src/hooks/settings/use-delete-user.ts +18 -8
- package/src/hooks/settings/use-link-social.ts +18 -8
- package/src/hooks/settings/use-list-accounts.ts +25 -15
- package/src/hooks/settings/use-list-device-sessions.ts +26 -21
- package/src/hooks/settings/use-list-sessions.ts +25 -14
- package/src/hooks/settings/use-list-user-passkeys.ts +25 -16
- package/src/hooks/settings/use-revoke-multi-session.ts +25 -16
- package/src/hooks/settings/use-revoke-session.ts +25 -16
- package/src/hooks/settings/use-set-active-session.ts +35 -24
- package/src/hooks/settings/use-unlink-account.ts +22 -15
- package/src/hooks/settings/use-update-user.ts +29 -22
- package/src/hooks/use-auth-mutation.ts +29 -0
- package/src/hooks/use-auth-query.ts +36 -0
- package/src/index.ts +2 -2
- package/src/mutations/auth/is-username-available-options.ts +18 -0
- package/src/mutations/auth/request-password-reset-options.ts +14 -0
- package/src/mutations/auth/reset-password-options.ts +14 -0
- package/src/mutations/auth/send-verification-email-options.ts +14 -0
- package/src/mutations/auth/sign-in-email-options.ts +19 -0
- package/src/mutations/auth/sign-in-magic-link-options.ts +15 -0
- package/src/mutations/auth/sign-in-passkey-options.ts +15 -0
- package/src/mutations/auth/sign-in-social-options.ts +19 -0
- package/src/mutations/auth/sign-in-username-options.ts +15 -0
- package/src/mutations/auth/sign-out-options.ts +11 -0
- package/src/mutations/auth/sign-up-email-options.ts +15 -0
- package/src/mutations/auth-mutation-options.ts +49 -0
- package/src/mutations/settings/add-passkey-options.ts +15 -0
- package/src/mutations/settings/change-email-options.ts +11 -0
- package/src/mutations/settings/change-password-options.ts +14 -0
- package/src/mutations/settings/delete-passkey-options.ts +15 -0
- package/src/mutations/settings/delete-user-options.ts +11 -0
- package/src/mutations/settings/link-social-options.ts +11 -0
- package/src/mutations/settings/revoke-multi-session-options.ts +15 -0
- package/src/mutations/settings/revoke-session-options.ts +14 -0
- package/src/mutations/settings/set-active-session-options.ts +15 -0
- package/src/mutations/settings/unlink-account-options.ts +14 -0
- package/src/mutations/settings/update-user-options.ts +15 -0
- package/src/queries/auth/session-options.ts +18 -0
- package/src/queries/auth-query-options.ts +34 -0
- package/src/queries/settings/account-info-options.ts +25 -0
- package/src/queries/settings/list-accounts-options.ts +26 -0
- package/src/queries/settings/list-device-sessions-options.ts +24 -0
- package/src/queries/settings/list-sessions-options.ts +23 -0
- package/src/queries/settings/list-user-passkeys-options.ts +23 -0
- package/dist/hooks/auth/use-auth-mutation.d.ts +0 -18
- package/dist/hooks/auth/use-auth-mutation.js +0 -13
- package/dist/hooks/auth/use-auth-query.d.ts +0 -24
- package/dist/hooks/auth/use-auth-query.js +0 -13
- package/src/hooks/auth/use-auth-mutation.ts +0 -56
- package/src/hooks/auth/use-auth-query.ts +0 -50
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { revokeMultiSessionOptions } from '../../mutations/settings/revoke-multi-session-options';
|
|
3
|
+
export type UseRevokeMultiSessionParams = NonNullable<Parameters<AuthClient["multiSession"]["revoke"]>[0]>;
|
|
4
|
+
export type UseRevokeMultiSessionOptions = Omit<ReturnType<typeof revokeMultiSessionOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for revoking a device session in multi-session mode.
|
|
5
7
|
*
|
|
8
|
+
* Refetches the device sessions list on success.
|
|
9
|
+
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
6
11
|
* @returns The `useMutation` result.
|
|
7
12
|
*/
|
|
8
|
-
export declare function useRevokeMultiSession(options?:
|
|
9
|
-
sessionToken: string;
|
|
10
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
13
|
+
export declare function useRevokeMultiSession(options?: UseRevokeMultiSessionOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
11
14
|
sessionToken: string;
|
|
12
15
|
} & {
|
|
13
|
-
fetchOptions?:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
code?: string | undefined;
|
|
18
|
-
message?: string | undefined;
|
|
19
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
16
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
17
|
+
sessionToken: string;
|
|
18
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
19
|
+
}>, unknown>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useListDeviceSessions as t } from "./use-list-device-sessions.js";
|
|
3
|
+
import { revokeMultiSessionOptions as n } from "../../mutations/settings/revoke-multi-session-options.js";
|
|
4
|
+
import { useMutation as r } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/settings/use-revoke-multi-session.ts
|
|
5
|
-
function
|
|
6
|
-
let { authClient:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
await a(), await r?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
6
|
+
function i(i) {
|
|
7
|
+
let { authClient: a } = e(), { refetch: o } = t({ refetchOnMount: !1 });
|
|
8
|
+
return r({
|
|
9
|
+
...n(a),
|
|
10
|
+
...i,
|
|
11
|
+
onSuccess: async (...e) => {
|
|
12
|
+
await o(), await i?.onSuccess?.(...e);
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export { i as useRevokeMultiSession };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { revokeSessionOptions } from '../../mutations/settings/revoke-session-options';
|
|
3
|
+
export type UseRevokeSessionParams = NonNullable<Parameters<AuthClient["revokeSession"]>[0]>;
|
|
4
|
+
export type UseRevokeSessionOptions = Omit<ReturnType<typeof revokeSessionOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for revoking a user session.
|
|
5
7
|
*
|
|
8
|
+
* Refetches the sessions list on success.
|
|
9
|
+
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
6
11
|
* @returns The `useMutation` result.
|
|
7
12
|
*/
|
|
8
|
-
export declare function useRevokeSession(options?:
|
|
9
|
-
token: string;
|
|
10
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
13
|
+
export declare function useRevokeSession(options?: UseRevokeSessionOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
11
14
|
token: string;
|
|
12
15
|
} & {
|
|
13
|
-
fetchOptions?:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
code?: string | undefined;
|
|
18
|
-
message?: string | undefined;
|
|
19
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
16
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
17
|
+
token: string;
|
|
18
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
19
|
+
}>, unknown>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useListSessions as t } from "./use-list-sessions.js";
|
|
3
|
+
import { revokeSessionOptions as n } from "../../mutations/settings/revoke-session-options.js";
|
|
4
|
+
import { useMutation as r } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/settings/use-revoke-session.ts
|
|
5
|
-
function
|
|
6
|
-
let { authClient:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
await a(), await r?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
6
|
+
function i(i) {
|
|
7
|
+
let { authClient: a } = e(), { refetch: o } = t({ refetchOnMount: !1 });
|
|
8
|
+
return r({
|
|
9
|
+
...n(a),
|
|
10
|
+
...i,
|
|
11
|
+
onSuccess: async (...e) => {
|
|
12
|
+
await o(), await i?.onSuccess?.(...e);
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export { i as useRevokeSession };
|
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { setActiveSessionOptions } from '../../mutations/settings/set-active-session-options';
|
|
3
|
+
export type UseSetActiveSessionParams = NonNullable<Parameters<AuthClient["multiSession"]["setActive"]>[0]>;
|
|
4
|
+
export type UseSetActiveSessionOptions = Omit<ReturnType<typeof setActiveSessionOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that sets an active device session in multi-session mode.
|
|
5
7
|
*
|
|
8
|
+
* Optimistically switches the cached session to the matching device session,
|
|
9
|
+
* scrolls to top, and refetches both the session and device-session queries.
|
|
10
|
+
*
|
|
11
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
6
12
|
* @returns The `useMutation` result.
|
|
7
13
|
*/
|
|
8
|
-
export declare function useSetActiveSession(options?:
|
|
9
|
-
sessionToken: string;
|
|
10
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
14
|
+
export declare function useSetActiveSession(options?: UseSetActiveSessionOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
11
15
|
sessionToken: string;
|
|
12
16
|
} & {
|
|
13
|
-
fetchOptions?:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
createdAt: Date;
|
|
18
|
-
updatedAt: Date;
|
|
19
|
-
userId: string;
|
|
20
|
-
expiresAt: Date;
|
|
21
|
-
token: string;
|
|
22
|
-
ipAddress?: string | null | undefined;
|
|
23
|
-
userAgent?: string | null | undefined;
|
|
24
|
-
} & Record<string, any>;
|
|
25
|
-
user: {
|
|
26
|
-
id: string;
|
|
27
|
-
createdAt: Date;
|
|
28
|
-
updatedAt: Date;
|
|
29
|
-
email: string;
|
|
30
|
-
emailVerified: boolean;
|
|
31
|
-
name: string;
|
|
32
|
-
image?: string | null | undefined;
|
|
33
|
-
} & Record<string, any>;
|
|
34
|
-
}, {
|
|
35
|
-
code?: string | undefined;
|
|
36
|
-
message?: string | undefined;
|
|
37
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
17
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
+
sessionToken: string;
|
|
19
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
20
|
+
}>, unknown>;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { sessionOptions as t } from "../../queries/auth/session-options.js";
|
|
3
3
|
import { useSession as n } from "../auth/use-session.js";
|
|
4
4
|
import { useListDeviceSessions as r } from "./use-list-device-sessions.js";
|
|
5
|
-
import {
|
|
5
|
+
import { setActiveSessionOptions as i } from "../../mutations/settings/set-active-session-options.js";
|
|
6
|
+
import { useMutation as a, useQueryClient as o } from "@tanstack/react-query";
|
|
6
7
|
//#region src/hooks/settings/use-set-active-session.ts
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
r && o.setQueryData(["auth", "getSession"], r), window.scrollTo({ top: 0 }), await c(), await u(), await a?.onSuccess?.(e, { sessionToken: t }, ...n);
|
|
16
|
-
}
|
|
8
|
+
function s(s) {
|
|
9
|
+
let c = o(), { authClient: l } = e(), { refetch: u } = n({ refetchOnMount: !1 }), { data: d, refetch: f } = r({ refetchOnMount: !1 });
|
|
10
|
+
return a({
|
|
11
|
+
...i(l),
|
|
12
|
+
...s,
|
|
13
|
+
onSuccess: async (e, n, ...r) => {
|
|
14
|
+
let i = n?.sessionToken, a = d?.find((e) => e.session.token === i);
|
|
15
|
+
a && c.setQueryData(t(l).queryKey, a), window.scrollTo({ top: 0 }), await u(), await f(), await s?.onSuccess?.(e, n, ...r);
|
|
17
16
|
}
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
19
|
//#endregion
|
|
21
|
-
export {
|
|
20
|
+
export { s as useSetActiveSession };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { unlinkAccountOptions } from '../../mutations/settings/unlink-account-options';
|
|
3
|
+
export type UseUnlinkAccountParams = NonNullable<Parameters<AuthClient["unlinkAccount"]>[0]>;
|
|
4
|
+
export type UseUnlinkAccountOptions = Omit<ReturnType<typeof unlinkAccountOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for unlinking a social provider from the current user.
|
|
5
7
|
*
|
|
8
|
+
* Refetches the linked accounts list on success.
|
|
9
|
+
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
6
11
|
* @returns The `useMutation` result.
|
|
7
12
|
*/
|
|
8
|
-
export declare function useUnlinkAccount(options?:
|
|
9
|
-
providerId: string;
|
|
10
|
-
accountId?: string | undefined;
|
|
11
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
13
|
+
export declare function useUnlinkAccount(options?: UseUnlinkAccountOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
12
14
|
providerId: string;
|
|
13
15
|
accountId?: string | undefined;
|
|
14
16
|
} & {
|
|
15
|
-
fetchOptions?:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
message?: string | undefined;
|
|
21
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
17
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
+
providerId: string;
|
|
19
|
+
accountId?: string | undefined;
|
|
20
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
21
|
+
}>, unknown>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useListAccounts as t } from "./use-list-accounts.js";
|
|
3
|
+
import { unlinkAccountOptions as n } from "../../mutations/settings/unlink-account-options.js";
|
|
4
|
+
import { useMutation as r } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/settings/use-unlink-account.ts
|
|
5
|
-
function
|
|
6
|
-
let { authClient:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
await a(), await r?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
6
|
+
function i(i) {
|
|
7
|
+
let { authClient: a } = e(), { refetch: o } = t({ refetchOnMount: !1 });
|
|
8
|
+
return r({
|
|
9
|
+
...n(a),
|
|
10
|
+
...i,
|
|
11
|
+
onSuccess: async (...e) => {
|
|
12
|
+
await o(), await i?.onSuccess?.(...e);
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export { i as useUnlinkAccount };
|