fix: remove callback url from endpoints that doesn't necessarily need it (#362)

This commit is contained in:
Bereket Engida
2024-10-30 10:42:02 +03:00
committed by GitHub
parent 5e0edd35c2
commit cb6492e05f
3 changed files with 37 additions and 22 deletions

View File

@@ -41,7 +41,6 @@ To signup a user, you can use the `signUp.email` function provided by the client
- `password`: The password of the user. It should be at least 8 characters long and max 32 by default.
- `name`: The name of the user.
- `image`: The image of the user. (optional)
- `callbackURL`: The url to redirect to after the user has signed up. (optional)
```ts title="client.ts"
const { data, error } = await authClient.signUp.email({
@@ -49,7 +48,6 @@ const { data, error } = await authClient.signUp.email({
password: "password1234",
name: "test",
image: "https://example.com/image.png",
callbackURL: "/",
});
```
@@ -59,14 +57,13 @@ To signin a user, you can use the `signIn.email` function provided by the client
- `email`: The email address of the user.
- `password`: The password of the user.
- `callbackURL`: The url to redirect to after the user has signed in. (optional)
- `dontRememberMe`: If true, the user will be signed out when the browser is closed. (optional)
- `callbackURL`: The URL to redirect to after the user signs in. (optional)
```ts title="client.ts"
const { data, error } = await authClient.signIn.email({
email: "test@example.com",
password: "password1234",
callbackURL: "/",
});
```
@@ -78,6 +75,18 @@ To signout a user, you can use the `signOut` function provided by the client.
await client.signOut();
```
you can pass `fetchOptions` to redirect onSuccess
```ts title="client.ts"
await client.signOut({
fetchOptions: {
onSuccess: () => {
router.push("/login"); // redirect to login page
},
},
});
```
### Email Verification
To enable email verification, you need to pass a function that sends a verification email with a link. The `sendVerificationEmail` function takes an object with the following properties: