refactor: Obtém cliente criado e exibe nome na notificação.

This commit is contained in:
LukiBeg 2025-11-17 17:19:23 -03:00
parent 47eeaa59be
commit 7fce28174e
1 changed files with 2 additions and 3 deletions

View File

@ -24,7 +24,6 @@ public function save(ClientService $clientService)
$data = $this->form->all();
$data['name'] = $data['client_name'];
if ($this->form->profile_image_path) {
$path = $this->form->profile_image_path->store('client_logos', 'public');
$data['profile_image_path'] = $path;
@ -32,10 +31,10 @@ public function save(ClientService $clientService)
$data['root_password'] = Crypt::encryptString($data['root_password']);
$clientService->addClient($data);
$client = $clientService->addClient($data);
$this->dispatch('client-added');
$this->dispatch('notify', message: 'Cliente adicionado com sucesso!');
$this->dispatch('notify', message: $client->name . ' Cliente adicionado com sucesso!');
} catch (\Exception $e) {
$this->dispatch('notify', message: 'Ocorreu um erro inesperado ao salvar.', type: 'error');
}