From ae1266e2daad7834d47931b0d9ad0064c3d340a8 Mon Sep 17 00:00:00 2001 From: Hossain Mohammad Shahidullah Jaber Date: Thu, 3 Aug 2023 00:48:38 +0600 Subject: [PATCH 1/2] import VerifyCsrfToken --- routes/api.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/routes/api.php b/routes/api.php index c7a5d5a..59f0837 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,14 +1,15 @@ PreventRegularBrowserAccess::class], function () { Route::post('_native/api/booted', NativeAppBootedController::class); Route::post('_native/api/events', DispatchEventFromAppController::class); -})->withoutMiddleware(\App\Http\Middleware\VerifyCsrfToken::class); +})->withoutMiddleware(VerifyCsrfToken::class); Route::get('_native/api/cookie', CreateSecurityCookieController::class); From aff2080c57d945729a1ce4cffa1f6d649bd9d0f0 Mon Sep 17 00:00:00 2001 From: Hossain Mohammad Shahidullah Jaber Date: Thu, 3 Aug 2023 01:12:49 +0600 Subject: [PATCH 2/2] refector --- src/Dialog.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Dialog.php b/src/Dialog.php index 0913a69..fb7f89c 100644 --- a/src/Dialog.php +++ b/src/Dialog.php @@ -121,18 +121,23 @@ public function asSheet(string $windowId = null): self return $this; } - public function open() + public function dataArray(): array { - $result = $this->client->post('dialog/open', [ + return [ 'title' => $this->title, 'windowReference' => $this->windowReference, 'defaultPath' => $this->defaultPath, 'filters' => $this->filters, 'buttonLabel' => $this->buttonLabel, 'properties' => array_unique($this->properties), - ])->json('result'); + ]; + } + + public function open() + { + $result = $this->client->post('dialog/open', $this->dataArray())->json('result'); - if (! in_array('multiSelections', $this->properties)) { + if (!in_array('multiSelections', $this->properties)) { return $result[0] ?? null; } @@ -141,13 +146,6 @@ public function open() public function save() { - return $this->client->post('dialog/save', [ - 'title' => $this->title, - 'windowReference' => $this->windowReference, - 'defaultPath' => $this->defaultPath, - 'filters' => $this->filters, - 'buttonLabel' => $this->buttonLabel, - 'properties' => array_unique($this->properties), - ])->json('result'); + return $this->client->post('dialog/save', $this->dataArray())->json('result'); } }