Closed gundall closed 1 year ago
I have found a working solution for this, and commited it into my forked version of this repository. I'll create a pull request in order to let you decide if it is worthwhile, or not.
This solution works this way: if you need more params (e.g. "avatar"), there are two things to do:
["avatar"]
.This is how it would look in the previous example:
import axios from "axios";
// Stuff...
axios
.post(`${BASE_URL}api/passwordless/send-link`, {
...{
avatar: "1",
email: "john@doe.com",
username: "JohnnyDoe21",
keepParams: ["avatar"]
},
...{
headers: {
cors: "*"
}
}
})
@gundall thanks for the solution, works well.
Hi! I noticed that if you use the plugin's
/api/passwordless/send-link
endpoint with non-existing user data, it will create a new user with that data. I'm taking advantage of this feature in my project's registration view, but I need to add an avatar as an additional parameter:The problem is that when I send the data to the endpoint (avatar, username, and email), the "avatar" field is ignored by the plugin. If I check the users-permissions's beforeCreate life cycle method, the "params" field doesn't contain "avatar"; it is removed:
Is there a way to make the plugin to keep certain params if required?
Thank you in advance!