mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
Migrate to HTMX (#114)
Dropped Livewire Added HTMX Added Blade code lint Drop Mysql and Redis Migrate to SQLite
This commit is contained in:
30
app/Http/Middleware/HandleSSHErrors.php
Normal file
30
app/Http/Middleware/HandleSSHErrors.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Exceptions\SSHCommandError;
|
||||
use App\Exceptions\SSHConnectionError;
|
||||
use App\Facades\Toast;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HandleSSHErrors
|
||||
{
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$res = $next($request);
|
||||
if ($res->exception) {
|
||||
if ($res->exception instanceof SSHConnectionError || $res->exception instanceof SSHCommandError) {
|
||||
Toast::error($res->exception->getMessage());
|
||||
|
||||
if ($request->hasHeader('HX-Request')) {
|
||||
return htmx()->back();
|
||||
}
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user