fix(js-sdk): allow passing custom request body parameters in auth.register method (#12545)
The `auth.login` method of the JS SDK allows passing custom, which is useful for custom authentication providers. For example:
```ts
const response = await sdk.auth.login("customer", "phone-auth", {
phone
})
```
However, the `auth.register` method doesn't allow that, so we can't do the following:
```ts
const response = await sdk.auth.register("customer", "phone-auth", {
phone
})
```
Instead, we'd have to use the `client.fetch` method.
This PR fixes the input type of the payload passed to the `register` method to be similar to that of `login`, which would allow using it with custom authentication providers
This commit is contained in:
5
.changeset/beige-carrots-care.md
Normal file
5
.changeset/beige-carrots-care.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/js-sdk": patch
|
||||
---
|
||||
|
||||
fix(js-sdk): allow passing custom request body parameters in auth.register method
|
||||
@@ -48,7 +48,7 @@ export class Auth {
|
||||
register = async (
|
||||
actor: string,
|
||||
method: string,
|
||||
payload: HttpTypes.AdminSignUpWithEmailPassword
|
||||
payload: HttpTypes.AdminSignUpWithEmailPassword | Record<string, unknown>
|
||||
) => {
|
||||
const { token } = await this.client.fetch<{ token: string }>(
|
||||
`/auth/${actor}/${method}/register`,
|
||||
|
||||
Reference in New Issue
Block a user