Closed michelsteege closed 8 years ago
So is the alterLoginSuccessResponse
a custom method you have on your member object? Just wondering what is the purpose of it to see if it should be in the core?
Yes it is a custom method in a member extension, it would be better to check if the method exists instead of a try catch but i am not sure if that works with extensions.
In am building an application with silverstripe as the backend a angular app as the frontend this module as the api, but i want to do the login action and then display the name of the user without doing a second call to get the member data so that is why i added the custom method
I guess avoiding extra api request is not a bad thing.
I am not in favour of including method calls that are specific to a use case. But that said, I had rather see the Member
object added directly to the response, like $response['member'] = $member
. Then it gets serialised etc. as normal.
That would be great because my custom method looks like this:
public function alterLoginSuccessResponse($response){
$response['Member'] = $this->owner->toMap();
return $response;
}
I've added the custom method instead of the member object because i wasn't sure if there was a reason it isn't in the code already (since there is a MemberID) but either way it would work great for me! :+1:
Very useful module btw!
I needed to add some more data to the response for my application, it would be nice to have this option in the module