-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create barebones sequence for logging in
- Loading branch information
1 parent
c7a3779
commit cc602d8
Showing
5 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class LogInController extends Controller | ||
{ | ||
public function __invoke(Request $request): JsonResponse | ||
{ | ||
$request->validate([ | ||
'email' => ['required'], | ||
'password' => ['required'], | ||
]); | ||
|
||
if ( | ||
Auth::attempt([ | ||
'email' => $request->input('email'), | ||
'password' => $request->input('password'), | ||
]) | ||
) { | ||
// LOG ATTEMPT? | ||
return response() | ||
->json([ | ||
'token' => 'TOKEN_GOES_HERE', | ||
]); | ||
} else { | ||
// LOG ATTEMPT? | ||
return response() | ||
->json(['error' => 'UNABLE_TO_LOG_IN']); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup> | ||
// | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div class="max-w-5xl mx-auto my-10"> | ||
Hello world | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<?php | ||
|
||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Api\CurrencyController; | ||
use App\Http\Controllers\Api\LogInController; | ||
|
||
Route::get('/currencies', \App\Http\Controllers\Api\CurrencyController::class); | ||
Route::post('/log-in', LogInController::class); | ||
|
||
Route::get('/currencies', CurrencyController::class); |