Skip to content

Commit bcc92e1

Browse files
committed
fix: in dev mode do not ask confirmation on delete
1 parent 31cf329 commit bcc92e1

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

app/Livewire/Project/Shared/Danger.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ public function mount()
9191

9292
public function delete($password)
9393
{
94-
if (! Hash::check($password, Auth::user()->password)) {
95-
$this->addError('password', 'The provided password is incorrect.');
94+
if (isProduction()) {
95+
if (! Hash::check($password, Auth::user()->password)) {
96+
$this->addError('password', 'The provided password is incorrect.');
9697

97-
return;
98+
return;
99+
}
98100
}
99101

100102
if (! $this->resource) {

bootstrap/helpers/shared.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ function isSubscribed()
343343
{
344344
return isSubscriptionActive() || auth()->user()->isInstanceAdmin();
345345
}
346+
347+
function isProduction(): bool
348+
{
349+
return ! isDev();
350+
}
346351
function isDev(): bool
347352
{
348353
return config('app.env') === 'local';

resources/views/components/modal-confirmation.blade.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,16 @@ class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">
296296
</template>
297297

298298
<template x-if="step === 1">
299-
<x-forms.button @click="step++" class="w-auto" isError>
300-
<span x-text="step1ButtonText"></span>
301-
</x-forms.button>
299+
@if(isDev())
300+
<x-forms.button class="w-auto" isError
301+
@click="$wire.delete('hello')">
302+
<span x-text="step3ButtonText"></span>
303+
</x-forms.button>
304+
@else
305+
<x-forms.button @click="step++" class="w-auto" isError>
306+
<span x-text="step1ButtonText"></span>
307+
</x-forms.button>
308+
@endif
302309
</template>
303310

304311
<template x-if="step === 2">

0 commit comments

Comments
 (0)