File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Exceptions ;
4+
5+ use Exception ;
6+
7+ class ErrorToastException extends Exception
8+ {
9+ //
10+ }
Original file line number Diff line number Diff line change 11<?php
22
3+ use App \Exceptions \ErrorToastException ;
34use App \Http \Middleware \EncryptCookies ;
45use App \Http \Middleware \HandleInertiaRequests ;
56use Illuminate \Cookie \Middleware \EncryptCookies as BaseEncryptCookies ;
6667 return $ response ;
6768 }
6869 // Return JSON response for PrimeVue toast to display
70+ $ errorSummary = "$ statusCode - $ errorTitles [$ statusCode ]" ;
71+ $ errorDetail = $ errorDetails [$ statusCode ];
72+ if (get_class ($ exception ) === ErrorToastException::class) {
73+ $ errorSummary = "$ statusCode - Error " ;
74+ $ errorDetail = $ exception ->getMessage ();
75+ }
6976 return response ()->json ([
70- 'error_summary ' => " $ statusCode - $ errorTitles [ $ statusCode ]" ,
71- 'error_detail ' => $ errorDetails [ $ statusCode ] ,
77+ 'error_summary ' => $ errorSummary ,
78+ 'error_detail ' => $ errorDetail ,
7279 ], $ statusCode );
7380 }
7481 } elseif ($ statusCode === 419 ) {
7582 return back ()->with ([
76- 'flash_message ' => 'The page expired, please try again. ' ,
83+ 'flash_warn ' => 'The page expired, please try again. ' ,
7784 ]);
7885 }
7986
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ createInertiaApp({
4444 summary : responseBody . error_summary ,
4545 detail : responseBody . error_detail ,
4646 life : 5000 ,
47- styleClass : 'mb-0 mt-4' ,
47+ styleClass : 'shadow-lg mb-0 mt-4' ,
4848 } ) ;
4949 }
5050 } ) ;
You can’t perform that action at this time.
0 commit comments