feat: Modal para edição de usuários finalizado.
This commit is contained in:
parent
76226ab7f7
commit
d15074b4b9
|
|
@ -5,11 +5,15 @@
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use Livewire\Attributes\On;
|
||||||
|
|
||||||
class ShowUsers extends Component
|
class ShowUsers extends Component
|
||||||
{
|
{
|
||||||
public $users = [];
|
public $users = [];
|
||||||
|
|
||||||
|
#[On('user-updated')]
|
||||||
|
#[On('user-created')]
|
||||||
|
|
||||||
public function mount(UserService $userService)
|
public function mount(UserService $userService)
|
||||||
{
|
{
|
||||||
$this->users = $userService->showUsers();
|
$this->users = $userService->showUsers();
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public function editUser(UserService $userService)
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dispatch('user-updated');
|
$this->dispatch('user-updated');
|
||||||
$this->dispatch('notify', message: $this->clientForm->client_name . ' atualizado com sucesso!');
|
$this->dispatch('notify', message: $this->userForm->name . ' atualizado com sucesso!');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->dispatch('notify', message: 'Falha na edição: ' . $e->getMessage(), type: 'error');
|
$this->dispatch('notify', message: 'Falha na edição: ' . $e->getMessage(), type: 'error');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue