- Added AuthController for client login and token management. - Introduced AuthGate for handling authentication state and login UI. - Updated API to support fetching client data for pre-filling forms. - Modified App.vue to pre-fill client information if logged in. - Enhanced client model to include username and password fields. - Created migration for adding username and password to clients table. - Added utility for generating secure usernames and passwords. - Updated frontend to handle client tokens for pre-filling checkout forms. - Removed old CSS file and updated HTML references to new assets. - Added StatsOverview widget for displaying client and quote statistics. - Improved error handling and user feedback in the login process.
24 lines
983 B
PHP
24 lines
983 B
PHP
<?php
|
|
|
|
use App\Http\Controllers\Api\AuthController;
|
|
use App\Http\Controllers\Api\CarrelloController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
// Espone al configuratore l'URL corrente dell'app cliente (checkout), così il
|
|
// frontend non deve indovinare la porta su cui gira Vite (può cambiare se 5174 è occupata).
|
|
Route::get('config', fn () => response()->json([
|
|
'frontend_cliente_url' => config('preventivi.frontend_cliente_url'),
|
|
]));
|
|
|
|
Route::prefix('auth')->group(function () {
|
|
Route::post('login', [AuthController::class, 'login']);
|
|
Route::middleware('auth:sanctum')->get('me', [AuthController::class, 'me']);
|
|
});
|
|
|
|
Route::prefix('carrello')->group(function () {
|
|
Route::post('aggiungi', [CarrelloController::class, 'aggiungi']);
|
|
Route::get('{token}', [CarrelloController::class, 'mostra']);
|
|
Route::delete('{token}/item/{item}', [CarrelloController::class, 'rimuoviItem']);
|
|
Route::post('{token}/conferma', [CarrelloController::class, 'conferma']);
|
|
});
|