diff --git a/apps/demo/src/app/page.tsx b/apps/demo/src/app/page.tsx index 5cb08b8d9..7bcc6e13e 100644 --- a/apps/demo/src/app/page.tsx +++ b/apps/demo/src/app/page.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +import CardFrame from 'stack/src/elements/CardFrame'; import { stackServerApp } from 'src/stack'; import ColorModeButton from 'src/components/ColorThemeButton'; import SignOutButton from 'src/components/SignOutButton'; @@ -7,37 +8,40 @@ import UserInfoClient from 'src/components/UserInfoClient'; export default async function Page() { return ( -
-
-
Server:
- -
-
Client:
- -
+ //
+ //
+ //
Server:
+ // + //
+ //
Client:
+ // + //
-
- - Sign in - - - Sign up - -
- - - Sign out (server) - -
- + //
+ // + // Sign in + // + // + // Sign up + // + //
+ // + // + // Sign out (server) + // + //
+ // -
- - Protected client - - - Protected server - + //
+ // + // Protected client + // + // + // Protected server + // + //
+
+

Stack Demo

); } diff --git a/apps/demo/src/app/protected-client/page.tsx b/apps/demo/src/app/protected-client/page.tsx deleted file mode 100644 index bb87fed47..000000000 --- a/apps/demo/src/app/protected-client/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -'use client'; -import { useUser } from "stack"; - -export default function ProtectedPage() { - useUser({ or: 'redirect' }); - return
This is protected. You can see this because you are signed in
; -} \ No newline at end of file diff --git a/apps/demo/src/app/protected-server/page.tsx b/apps/demo/src/app/protected/page.tsx similarity index 100% rename from apps/demo/src/app/protected-server/page.tsx rename to apps/demo/src/app/protected/page.tsx diff --git a/apps/demo/src/app/signin/custom-credential.tsx b/apps/demo/src/app/signin/custom-credential.tsx deleted file mode 100644 index 81b714eb9..000000000 --- a/apps/demo/src/app/signin/custom-credential.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* eslint-disable @typescript-eslint/no-misused-promises */ -'use client'; -import { useStackApp, validateEmail } from "stack"; -import { useState } from "react"; - -export default function CustomCredentialSignIn() { - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const [error, setError] = useState(''); - const app = useStackApp(); - - const onSubmit = async () => { - if (!validateEmail(email)) { - setError('Please enter a valid email'); - return; - } - if (!password) { - setError('Please enter your password'); - return; - } - const errorCode = await app.signInWithCredential({ email, password, redirectUrl: app.urls.userHome }); - // It is better to handle each error code separately, but for simplicity, we will just show the error code directly - if (errorCode) { - setError(errorCode); - } - }; - - return ( -
- {error} - setEmail(e.target.value)} /> - setPassword(e.target.value)} /> - -
- ); -} \ No newline at end of file diff --git a/apps/demo/src/app/signin/custom-oauth.tsx b/apps/demo/src/app/signin/custom-oauth.tsx deleted file mode 100644 index c2b870035..000000000 --- a/apps/demo/src/app/signin/custom-oauth.tsx +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable @typescript-eslint/no-misused-promises */ -'use client'; -import { useStackApp } from "stack"; - -export default function CustomOAuthSignIn() { - const app = useStackApp(); - - return
-

My Custom Sign In page

- -
; -} \ No newline at end of file diff --git a/apps/demo/src/app/signin/page.tsx b/apps/demo/src/app/signin/page.tsx deleted file mode 100644 index 52b423ddb..000000000 --- a/apps/demo/src/app/signin/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { SignIn } from "stack"; -import { stackServerApp } from "src/stack"; -import CustomCredentialSignIn from "./custom-credential"; -import CustomOAuthSignIn from "./custom-oauth"; - -export default function Page() { - return ; - // return ; - // return ; -} diff --git a/apps/demo/src/components/SignOutButton.tsx b/apps/demo/src/components/SignOutButton.tsx index 868354440..fee883899 100644 --- a/apps/demo/src/components/SignOutButton.tsx +++ b/apps/demo/src/components/SignOutButton.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useUser, useStackApp } from "stack"; +import { useUser } from "stack"; import { runAsynchronously } from "stack-shared/dist/utils/promises"; export default function SignOutButton() { diff --git a/apps/demo/src/stack.tsx b/apps/demo/src/stack.tsx index e965733a9..afecb69b2 100644 --- a/apps/demo/src/stack.tsx +++ b/apps/demo/src/stack.tsx @@ -4,7 +4,4 @@ import { StackServerApp } from "stack"; export const stackServerApp = new StackServerApp({ tokenStore: "nextjs-cookie", - urls: { - signIn: "/signin", - } });