Hoang Nguyen commited on
Commit
a9ff6a3
·
1 Parent(s): 4901b1e

feat(login): init form signin + signup

Browse files
src/app/(auth)/layout.tsx ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { ClerkProvider } from '@clerk/nextjs';
2
+ import { setRequestLocale } from 'next-intl/server';
3
+
4
+ export default async function AuthLayout(props: {
5
+ children: React.ReactNode;
6
+ params: Promise<{ locale: string }>;
7
+ }) {
8
+ const { locale } = await props.params;
9
+ setRequestLocale(locale);
10
+ let signInUrl = '/sign-in';
11
+ let signUpUrl = '/sign-up';
12
+ let dashboardUrl = '/dashboard';
13
+ let afterSignOutUrl = '/';
14
+
15
+ signInUrl = `/${signInUrl}`;
16
+ signUpUrl = `/${signUpUrl}`;
17
+ dashboardUrl = `/`;
18
+ afterSignOutUrl = `/${afterSignOutUrl}`;
19
+
20
+ return (
21
+ <ClerkProvider
22
+ localization={{
23
+ signIn: {
24
+ start: {
25
+ title: 'Sign In',
26
+ },
27
+ },
28
+ signUp: {
29
+ start: {
30
+ title: 'Sign Up',
31
+ },
32
+ },
33
+ }}
34
+ signInUrl={signInUrl}
35
+ signUpUrl={signUpUrl}
36
+ signInFallbackRedirectUrl={dashboardUrl}
37
+ signUpFallbackRedirectUrl={dashboardUrl}
38
+ afterSignOutUrl={afterSignOutUrl}
39
+ >
40
+ <div className="mx-auto flex w-full items-center justify-center pt-32">
41
+ {props.children}
42
+ </div>
43
+ </ClerkProvider>
44
+ );
45
+ }
src/app/(auth)/sign-in/page.tsx ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { SignIn } from '@clerk/nextjs';
2
+
3
+ type ISignInPageProps = {
4
+ params: Promise<{ locale: string }>;
5
+ };
6
+
7
+ export default async function SignInPage(_props: ISignInPageProps) {
8
+ return (
9
+ <SignIn
10
+ path="/sign-in"
11
+ signUpUrl="/sign-up"
12
+ />
13
+ );
14
+ };
src/app/(auth)/sign-up/page.tsx ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { SignUp } from '@clerk/nextjs';
2
+
3
+ type ISignUpPageProps = {
4
+ params: Promise<{ locale: string }>;
5
+ };
6
+
7
+ export default async function SignUpPage(_props: ISignUpPageProps) {
8
+ return (
9
+ <SignUp
10
+ path="/sign-up"
11
+ signInUrl="/sign-in"
12
+ />
13
+ );
14
+ };
src/utils/AppConfig.ts CHANGED
@@ -5,7 +5,7 @@ const localePrefix: LocalePrefixMode = 'as-needed';
5
  // FIXME: Update this configuration file based on your project information
6
  export const AppConfig = {
7
  name: 'Nextjs Starter',
8
- locales: ['en', 'fr'],
9
  defaultLocale: 'en',
10
  localePrefix,
11
  };
 
5
  // FIXME: Update this configuration file based on your project information
6
  export const AppConfig = {
7
  name: 'Nextjs Starter',
8
+ locales: ['en', 'fr', 'vi'],
9
  defaultLocale: 'en',
10
  localePrefix,
11
  };