fipamo/app/Http/Controllers/API/AuthAPIController.php
ro 166e19a656
AuthAPI, favicon tweak
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...
2024-03-07 12:04:52 -06:00

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);
}
}