Skip to content

Commit

Permalink
Merge pull request #92 from ahtinurme/bugfix-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
MohmmedAshraf authored Mar 22, 2024
2 parents bb7edf8 + bfb74eb commit c4889ec
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"php": "^8.2|^8.3",
"based/momentum-modal": "^0.3.0",
"brick/varexporter": "^0.4.0",
"illuminate/contracts": "^11.0",
"illuminate/contracts": "^10.0|^11.0",
"inertiajs/inertia-laravel": "^1.0",
"spatie/laravel-package-tools": "^1.0",
"stichoza/google-translate-php": "^5.1",
Expand Down Expand Up @@ -83,4 +83,4 @@
},
"minimum-stability": "stable",
"prefer-stable": true
}
}
6 changes: 3 additions & 3 deletions resources/scripts/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { PageProps as InertiaPageProps } from '@inertiajs/core';
import { AxiosInstance } from 'axios';
import ziggyRoute from 'ziggy-js';
import { route } from 'ziggy-js';
import { PageProps as AppPageProps } from './';

declare global {
interface Window {
axios: AxiosInstance;
}

let route: typeof ziggyRoute
let route: typeof route
}

declare module 'vue' {
interface ComponentCustomProperties {
route: typeof ziggyRoute;
route: typeof route;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/ImportTranslationsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function importLanguages(): void
{
if (! Schema::hasTable('ltu_languages') || Language::count() === 0) {
if ($this->confirm('The ltu_languages table does not exist or is empty, would you like to install the default languages?', true)) {
$this->callSilent('db:seed', ['--class' => LanguagesTableSeeder::class]);
$this->call('db:seed', ['--class' => LanguagesTableSeeder::class]);
} else {
$this->error('The ltu_languages table does not exist or is empty, please run the translations:install command first.');

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/PublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PublishCommand extends Command

public function handle(): int
{
$force = boolval($this->option('force'));
$force = (bool)$this->option('force');

if (! $force && File::exists(public_path('vendor/translations-ui'))) {
$this->line('Your application already have the Translations UI assets');
Expand Down
5 changes: 3 additions & 2 deletions src/Exceptions/TranslationsUIExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Inertia\Inertia;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Throwable;
use Illuminate\Auth\AuthenticationException;

if (class_exists('App\Exceptions\Handler')) {
class ExtendedHandler extends Handler
Expand All @@ -35,7 +36,7 @@ public static function isTranslationsUIRequest(Request $request): bool

public function render($request, Throwable $e): Response|JsonResponse|\Symfony\Component\HttpFoundation\Response
{
if ($this->isTranslationsUIRequest($request)) {
if (self::isTranslationsUIRequest($request)) {
return $this->renderInertiaException($request, $this->prepareException($e));
}

Expand Down Expand Up @@ -67,7 +68,7 @@ protected function renderInertiaException($request, $e): Response|JsonResponse|\
])->toResponse($request)->setStatusCode($statusCode);
}

if ($statusCode === 500 && ! App::hasDebugModeEnabled()) {
if ($statusCode === 500 && !$e instanceof AuthenticationException && ! App::hasDebugModeEnabled()) {
return Inertia::render('error', [
'code' => '500',
'title' => 'Internal server error',
Expand Down

0 comments on commit c4889ec

Please sign in to comment.