Skip to content

Commit

Permalink
handle response
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Apr 25, 2024
1 parent 8f109e4 commit 9a6b270
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/userLookup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,8 @@ const AddNote = (props: { ckey: string }) => {

const { ckey } = props;

const global = useContext(GlobalContext);

const send = () => {
fetch(`${import.meta.env.VITE_API_PATH}/User/Note`, {
method: "POST",
Expand All @@ -473,6 +475,13 @@ const AddNote = (props: { ckey: string }) => {
Category: "1",
Confidential: confidential ? "true" : "false",
}),
}).then((response) => {
setAdding(false);
if (response) {
global?.updateAndShowToast(`Added note to ${ckey}.`);
} else {
global?.updateAndShowToast(`Failed to add note.`);
}
});
};

Expand Down

0 comments on commit 9a6b270

Please sign in to comment.