Compare commits

..

No commits in common. "main" and "1.2" have entirely different histories.
main ... 1.2

2 changed files with 3 additions and 9 deletions

View File

@ -3,7 +3,6 @@ import { getMessages } from '@controllers/MessageController';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { toastError } from '@controllers/Toasts'; import { toastError } from '@controllers/Toasts';
import ScrollToBottom from './ScrollToBottom'; import ScrollToBottom from './ScrollToBottom';
import { api } from '../main';
const MessageWrapper = () => { const MessageWrapper = () => {
const { const {
@ -11,14 +10,6 @@ const MessageWrapper = () => {
isLoading, isLoading,
isError, isError,
} = useQuery(['messages'], getMessages, { } = useQuery(['messages'], getMessages, {
onSuccess: (data) => {
data.map((message: any) => {
if (message.image) {
message.image = api.slice(0, -4) + message.image;
}
});
return data;
},
onError: (error) => { onError: (error) => {
toastError(error as string); toastError(error as string);
}, },

View File

@ -132,6 +132,9 @@ export const changeUserInfo = async (userId: string, formData: FormData) => {
newPassword, newPassword,
}), }),
}); });
if (!response.ok) {
return {error: response.statusText};
}
const data = await response.json(); const data = await response.json();
if (data.error) { if (data.error) {
return {error: data.error}; return {error: data.error};