Skip to content

Commit

Permalink
Added Edit Customer Functionality (#372)
Browse files Browse the repository at this point in the history
* Added Edit Customer Functionality

* Clean up edit customer UX a bit

* More minor improvements

Co-authored-by: reichert621 <reichertjalex@gmail.com>
  • Loading branch information
joelazwar and reichert621 authored Nov 13, 2020
1 parent 4ad9ce2 commit 382dfc3
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 115 deletions.
18 changes: 18 additions & 0 deletions assets/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,24 @@ export const fetchCustomer = async (id: string, token = getAccessToken()) => {
.then((res) => res.body.data);
};

export const updateCustomer = async (
id : string,
updates: any,
token = getAccessToken()
) => {
if (!token) {
throw new Error('Invalid token!');
}

return request
.put(`/api/customers/${id}`)
.set('Authorization', token)
.send({
customer: updates,
})
.then((res) => res.body.data);
};

export const createNewConversation = async (
accountId: string,
customerId: string
Expand Down
Loading

0 comments on commit 382dfc3

Please sign in to comment.