mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
updated docs
This commit is contained in:
parent
948252f93b
commit
3c1ea60725
@ -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>;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user