Skip to content

Commit b2af504

Browse files
committed
fix: move auth client and config in features folder
1 parent a842ffa commit b2af504

23 files changed

+35
-42
lines changed

app/emails/templates/login-code.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Container, Heading, Section, Text } from '@react-email/components';
22

3-
import { AUTH_EMAIL_OTP_EXPIRATION_IN_MINUTES } from '@/lib/auth/config';
43
import i18n from '@/lib/i18n';
54

65
import { EmailFooter } from '@/emails/components/email-footer';
76
import { EmailLayout } from '@/emails/components/email-layout';
87
import { styles } from '@/emails/styles';
8+
import { AUTH_EMAIL_OTP_EXPIRATION_IN_MINUTES } from '@/features/auth/config';
99

1010
export const TemplateLoginCode = (props: {
1111
language: string;

app/features/account/change-name-drawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { useForm } from 'react-hook-form';
66
import { useTranslation } from 'react-i18next';
77
import { toast } from 'sonner';
88

9-
import { authClient } from '@/lib/auth/client';
109
import { orpc } from '@/lib/orpc/client';
1110

1211
import {
@@ -31,6 +30,7 @@ import {
3130
FormFieldsAccountUpdateName,
3231
zFormFieldsAccountUpdateName,
3332
} from '@/features/account/schema';
33+
import { authClient } from '@/features/auth/client';
3434

3535
export const ChangeNameDrawer = (props: { children: ReactNode }) => {
3636
const { t } = useTranslation(['account']);

app/features/account/user-card.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { LogOutIcon, PenLineIcon } from 'lucide-react';
22
import { useTranslation } from 'react-i18next';
33

4-
import { authClient } from '@/lib/auth/client';
5-
64
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
75
import { Badge } from '@/components/ui/badge';
86
import { Button } from '@/components/ui/button';
97
import { Card, CardAction, CardHeader, CardTitle } from '@/components/ui/card';
108

119
import { AccountCardRow } from '@/features/account/account-card-row';
1210
import { ChangeNameDrawer } from '@/features/account/change-name-drawer';
11+
import { authClient } from '@/features/auth/client';
1312
import { ConfirmSignOut } from '@/features/auth/confirm-signout';
1413

1514
export const UserCard = () => {

app/lib/auth/client.ts renamed to app/features/auth/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { createAuthClient } from 'better-auth/react';
88
import { envClient } from '@/env/client';
99
import type { Auth } from '@/server/auth';
1010

11-
import { permissions } from '../../features/auth/permissions';
11+
import { permissions } from './permissions';
1212

1313
export const authClient = createAuthClient({
1414
baseURL: `${envClient.VITE_BASE_URL}/api/auth`,
File renamed without changes.

app/features/auth/confirm-signout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { ReactElement } from 'react';
33
import { useTranslation } from 'react-i18next';
44
import { toast } from 'sonner';
55

6-
import { authClient } from '@/lib/auth/client';
7-
86
import { ConfirmResponsiveDrawer } from '@/components/ui/confirm-responsive-drawer';
97

8+
import { authClient } from '@/features/auth/client';
9+
1010
export const ConfirmSignOut = (props: {
1111
children: ReactElement<{ onClick: () => unknown }>;
1212
}) => {

app/features/auth/guard-authenticated.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { useRouter } from '@tanstack/react-router';
22
import { ReactNode } from 'react';
33

4-
import { authClient } from '@/lib/auth/client';
5-
64
import { PageError } from '@/components/page-error';
75
import { Spinner } from '@/components/ui/spinner';
86

7+
import { authClient } from '@/features/auth/client';
98
import { PageOnboarding } from '@/features/auth/page-onboarding';
109
import { Permission, Role } from '@/features/auth/permissions';
1110

app/features/auth/guard-public-only.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { ReactNode } from 'react';
22

3-
import { authClient } from '@/lib/auth/client';
4-
53
import { PageError } from '@/components/page-error';
64
import { Spinner } from '@/components/ui/spinner';
75

6+
import { authClient } from '@/features/auth/client';
87
import { useRedirectAfterLogin } from '@/features/auth/utils';
98

109
export const GuardPublicOnly = ({ children }: { children?: ReactNode }) => {

app/features/auth/page-login-verify.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import { SubmitHandler, useForm } from 'react-hook-form';
55
import { Trans, useTranslation } from 'react-i18next';
66
import { toast } from 'sonner';
77

8-
import { authClient } from '@/lib/auth/client';
9-
import {
10-
AUTH_EMAIL_OTP_EXPIRATION_IN_MINUTES,
11-
AUTH_SIGNUP_ENABLED,
12-
} from '@/lib/auth/config';
13-
148
import {
159
Form,
1610
FormField,
@@ -20,6 +14,11 @@ import {
2014
} from '@/components/form';
2115
import { Button } from '@/components/ui/button';
2216

17+
import { authClient } from '@/features/auth/client';
18+
import {
19+
AUTH_EMAIL_OTP_EXPIRATION_IN_MINUTES,
20+
AUTH_SIGNUP_ENABLED,
21+
} from '@/features/auth/config';
2322
import { useMascot } from '@/features/auth/mascot';
2423
import {
2524
FormFieldsLoginVerify,

app/features/auth/page-login.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import { SubmitHandler, useForm } from 'react-hook-form';
55
import { useTranslation } from 'react-i18next';
66
import { toast } from 'sonner';
77

8-
import { authClient } from '@/lib/auth/client';
9-
import { AUTH_SIGNUP_ENABLED } from '@/lib/auth/config';
10-
118
import {
129
Form,
1310
FormField,
@@ -16,6 +13,8 @@ import {
1613
} from '@/components/form';
1714
import { Button } from '@/components/ui/button';
1815

16+
import { authClient } from '@/features/auth/client';
17+
import { AUTH_SIGNUP_ENABLED } from '@/features/auth/config';
1918
import { useMascot } from '@/features/auth/mascot';
2019
import { FormFieldsLogin, zFormFieldsLogin } from '@/features/auth/schema';
2120
import { LoginEmailHint } from '@/features/devtools/login-hint';

0 commit comments

Comments
 (0)