Skip to content

Commit a10a20c

Browse files
simonhampclaude
andcommitted
Stay on edit page after updating Wall of Love listing
Show a success callout on the form instead of redirecting to the dashboard, and update the existing photo preview when a new photo is uploaded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4cf5507 commit a10a20c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

app/Livewire/WallOfLoveSubmissionForm.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ public function submit(): mixed
7777

7878
$this->submission->update($data);
7979

80-
return to_route('dashboard')->with('success', 'Your listing has been updated.');
80+
if ($this->photo) {
81+
$this->existingPhoto = $data['photo_path'];
82+
$this->reset('photo');
83+
}
84+
85+
session()->flash('success', 'Your listing has been updated.');
86+
87+
return null;
8188
}
8289

8390
$photoPath = null;

resources/views/livewire/wall-of-love-submission-form.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<form wire:submit="submit" class="space-y-6">
2+
@if(session()->has('success'))
3+
<flux:callout variant="success" icon="check-circle">
4+
<flux:callout.text>{{ session('success') }}</flux:callout.text>
5+
</flux:callout>
6+
@endif
7+
28
@if(! $isEditing)
39
{{-- Name Field --}}
410
<flux:field>

0 commit comments

Comments
 (0)