updated docs

This commit is contained in:
Zai Shi 2024-03-13 10:55:24 +08:00
parent 948252f93b
commit 3c1ea60725
2 changed files with 5 additions and 6 deletions

View File

@ -82,7 +82,7 @@ Call `useUser` (or `getUser`) with the `{ or: 'redirect' }` option to protect th
## Signing out
You can sign out the user by redirecting them to `/handler/signout` or simply by calling `user.signOut()`.
You can sign out the user by redirecting them to `/handler/signout` or simply by calling `user.signOut()`. The user will be redirected to `afterSignOut` URL. you can customize it in the `StackServerApp` constructor (see [here](/docs/api-documentation/app)).
<Tabs>
@ -93,9 +93,7 @@ You can sign out the user by redirecting them to `/handler/signout` or simply by
export default function SignOutButton() {
const user = useUser();
return <button onClick={async () => {
await user?.signOut();
}>
return <button onClick={user?.signOut}>
Sign Out
</button>;
}

View File

@ -13,7 +13,7 @@ import { useStackApp, SignIn } from "@stackframe/stack";
export default function DefaultSignIn() {
const app = useStackApp();
return <SignIn fullPage redirectUrl={app.urls.signInRedirect} />;
return <SignIn fullPage />;
}
```
@ -72,8 +72,9 @@ export default function CustomCredentialSignIn() {
setError('Please enter your password');
return;
}
// this will rediret to app.urls.afterSignIn if successful, you can customize it in the StackServerApp constructor
const errorCode = await app.signInWithCredential({ email, password });
// It is better to handle each error code separately, but for simplicity in this example, we will just show the error code directly
// It is better to handle each error code separately, but we will just show the error code directly for simplicity here
if (errorCode) {
setError(errorCode);
}