Fix incorrect admin login error handling
Change-Id: I68c338b0cb7b261db6c9240cbc5c1e253290e753
diff --git a/client/src/components/ContactList.jsx b/client/src/components/ContactList.jsx
index 578d3c9..1f98091 100644
--- a/client/src/components/ContactList.jsx
+++ b/client/src/components/ContactList.jsx
@@ -61,7 +61,7 @@
const getContactDetails = async () => {
const controller = new AbortController();
try {
- const data = await axiosInstance.get(`/contacts/${currentContact.id}`, {
+ const { data } = await axiosInstance.get(`/contacts/${currentContact.id}`, {
signal: controller.signal,
});
console.log('CONTACT LIST - DETAILS: ', data);
diff --git a/client/src/components/ConversationListItem.tsx b/client/src/components/ConversationListItem.tsx
index aeef7de..9fa1acc 100644
--- a/client/src/components/ConversationListItem.tsx
+++ b/client/src/components/ConversationListItem.tsx
@@ -117,7 +117,7 @@
const getContactDetails = async () => {
const controller = new AbortController();
try {
- const data = await axiosInstance.get(`/contacts/${userId}`, {
+ const { data } = await axiosInstance.get(`/contacts/${userId}`, {
signal: controller.signal,
});
console.log('CONTACT LIST - DETAILS: ', data);
diff --git a/client/src/components/UsernameChooser.jsx b/client/src/components/UsernameChooser.jsx
index 77c1d73..19b8380 100644
--- a/client/src/components/UsernameChooser.jsx
+++ b/client/src/components/UsernameChooser.jsx
@@ -33,18 +33,14 @@
useEffect(() => {
if (isInputValid(query)) {
setIsLoading(true);
- axios
- .get(`/ns/username/${query}`, {
- baseURL: apiUrl,
- })
- .then((res) => {
- setIsLoading(false);
- if (res.status === 200) {
- setData(res.data);
- } else {
- throw res.status;
- }
- });
+ axios.get(`/ns/username/${query}`, { baseURL: apiUrl }).then((res) => {
+ setIsLoading(false);
+ if (res.status === 200) {
+ setData(res.data);
+ } else {
+ throw res.status;
+ }
+ });
} else {
setError(400);
}