refactor: remove user prefix from endpoints (#358)

This commit is contained in:
Bereket Engida
2024-10-28 12:33:59 +03:00
committed by GitHub
parent 463d7944f6
commit 1c7606d61e
23 changed files with 68 additions and 75 deletions

View File

@@ -3,16 +3,11 @@ import {
signOut,
twoFactorActions,
useListPasskeys,
userActions,
useSession,
revokeSession,
updateUser,
} from "@/libs/auth-client";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "./ui/card";
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";
import { UAParser } from "ua-parser-js";
import { Image, ImageFallback, ImageRoot } from "./ui/image";
import type { Session, User } from "better-auth/types";
@@ -109,7 +104,7 @@ export function UserCard(props: {
<button
class="text-red-500 opacity-80 cursor-pointer text-xs border-muted-foreground border-red-600 underline "
onClick={async () => {
const res = await userActions.revokeSession({
const res = await revokeSession({
id: activeSession.id,
});
@@ -216,7 +211,7 @@ function EditUserDialog(props: { user?: User }) {
<Button
onClick={async () => {
setIsLoading(true);
await userActions.update({
await updateUser({
image: image()
? await convertImageToBase64(image()!)
: undefined,

View File

@@ -8,9 +8,12 @@ export const {
signUp,
passkey: passkeyActions,
useListPasskeys,
user: userActions,
twoFactor: twoFactorActions,
$Infer,
updateUser,
changePassword,
revokeSession,
revokeSessions,
} = createAuthClient({
baseURL:
process.env.NODE_ENV === "development"