ro
166e19a656
Got the first part of the API working, which checks to see if there is a valid session active to set up requests also some small changes to get the favicon working, yeah, yeah, but it's cool looking...
37 lines
862 B
PHP
37 lines
862 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\AuthService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AuthAPIController extends Controller
|
|
{
|
|
public function __construct(
|
|
AuthService $authService
|
|
) {
|
|
$this->auth = $authService;
|
|
}
|
|
|
|
public function status(Request $request)
|
|
{
|
|
$result = [];
|
|
$data = json_decode($request->getContent());
|
|
if ($this->auth::status()) {
|
|
$result = [
|
|
'message' => 'Authorized',
|
|
'type' => 'apiUseAuthorized',
|
|
'token' => session('token'),
|
|
];
|
|
} else {
|
|
$result = [
|
|
'message' => 'Not Authorized',
|
|
'type' => 'apiUseNotAuthorized',
|
|
];
|
|
}
|
|
|
|
return response()->json($result);
|
|
}
|
|
}
|