1
0
mirror of https://github.com/flarum/core.git synced 2025-10-22 04:06:37 +02:00

Move some API error handling code around. It still sucks though

This commit is contained in:
Toby Zerner
2015-05-07 16:08:20 +09:30
parent a5b2a3da03
commit b5169512cb
4 changed files with 22 additions and 27 deletions

View File

@@ -21,8 +21,7 @@ class LoginAction extends BaseAction
$response = app('Flarum\Api\Actions\TokenAction')
->handle(new ApiRequest($request->only('identification', 'password')));
$data = $response->getData();
if (! empty($data->token)) {
if (($data = $response->getData()) && ! empty($data->token)) {
$response->withCookie($this->makeRememberCookie($data->token));
event(new UserLoggedIn($this->users->findOrFail($data->userId), $data->token));