From ab92f285bab18c5a7c83703034f2dff164493618 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Thu, 14 Apr 2022 11:35:00 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Krzysztof Rewak Co-authored-by: Ewelina Lasowy <56546832+EwelinaLasowy@users.noreply.github.com> --- app/Infrastructure/Http/Middleware/HandleInertiaRequests.php | 4 ++-- resources/js/Shared/InertiaLink.js | 2 +- resources/js/app.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Infrastructure/Http/Middleware/HandleInertiaRequests.php b/app/Infrastructure/Http/Middleware/HandleInertiaRequests.php index 09c845d..7344b7f 100644 --- a/app/Infrastructure/Http/Middleware/HandleInertiaRequests.php +++ b/app/Infrastructure/Http/Middleware/HandleInertiaRequests.php @@ -54,14 +54,14 @@ class HandleInertiaRequests extends Middleware protected function getYearsData(Request $request): Closure { - return fn() => $request->user() ? $this->yearPeriodRetriever->links() : []; + return fn(): array => $request->user() ? $this->yearPeriodRetriever->links() : []; } protected function getVacationRequestsCount(Request $request): Closure { $user = $request->user(); - return fn() => $user && $user->can("listAll", VacationRequest::class) + return fn(): ?int => $user && $user->can("listAll", VacationRequest::class) ? VacationRequest::query() ->whereBelongsTo($this->yearPeriodRetriever->selected()) ->states( diff --git a/resources/js/Shared/InertiaLink.js b/resources/js/Shared/InertiaLink.js index d279539..360d9c3 100644 --- a/resources/js/Shared/InertiaLink.js +++ b/resources/js/Shared/InertiaLink.js @@ -53,7 +53,7 @@ export default { replace: props.replace, preserveScroll: props.preserveScroll, preserveState: props.preserveState ?? (method !== 'get'), - onBefore: () => ! processing.value, + onBefore: () => !processing.value, onStart: () => processing.value = true, onFinish: () => processing.value = false, }) diff --git a/resources/js/app.js b/resources/js/app.js index 22aee25..47fe130 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -46,4 +46,4 @@ Flatpickr.setDefaults({ disableMobile: true, }) -Settings.defaultLocale = 'pl' \ No newline at end of file +Settings.defaultLocale = 'pl'