Skip to content

Commit

Permalink
Fixed unable to add new, edit or delete the client details error fixed (
Browse files Browse the repository at this point in the history
#1471)

* add/update client details req not sending error fixed

* fixed client creation, edit and delete errors

* Fixed the failing test case

---------

Co-authored-by: prasanthchaduvula <[email protected]>
  • Loading branch information
Shruti-Apte and prasanthchaduvula authored Sep 13, 2023
1 parent 95313d7 commit b0de63f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/javascript/src/components/Clients/ClientForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const ClientForm = ({
if (formType === "new") {
try {
const res = await clientApi.create(formData);
setClientData([...clientData, { ...res.data, minutes: 0 }]);
setClientData([...clientData, { ...res.data.client, minutes: 0 }]);
setnewClient(false);
Toastr.success("Client added successfully");
} catch {
Expand Down Expand Up @@ -300,9 +300,6 @@ const ClientForm = ({
disabled={disableBtn(values, errors, submitting)}
style="primary"
type="submit"
onClick={() => {
setSubmitting(true);
}}
>
SAVE CHANGES
</Button>
Expand Down
5 changes: 4 additions & 1 deletion app/views/internal_api/v1/clients/_client.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# frozen_string_literal: true

json.client do
json.extract! client, :id, :name, :email, :phone, :logo
json.extract! client, :id, :name, :email, :phone

json.logo client.logo.attached? ? client.logo_url : nil

json.address do
json.partial! "internal_api/v1/partial/address", locals: { address: }
end
Expand Down

0 comments on commit b0de63f

Please sign in to comment.