Compare commits
2 Commits
6d1072cc43
...
f878fe314d
| Author | SHA1 | Date |
|---|---|---|
|
|
f878fe314d | |
|
|
37181d714a |
|
|
@ -3,6 +3,7 @@ import { getMessages } from '@controllers/MessageController';
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
import { toastError } from '@controllers/Toasts';
|
||||
import ScrollToBottom from './ScrollToBottom';
|
||||
import { api } from '../main';
|
||||
|
||||
const MessageWrapper = () => {
|
||||
const {
|
||||
|
|
@ -10,6 +11,14 @@ const MessageWrapper = () => {
|
|||
isLoading,
|
||||
isError,
|
||||
} = useQuery(['messages'], getMessages, {
|
||||
onSuccess: (data) => {
|
||||
data.map((message: any) => {
|
||||
if (message.image) {
|
||||
message.image = api.slice(0, -4) + message.image;
|
||||
}
|
||||
});
|
||||
return data;
|
||||
},
|
||||
onError: (error) => {
|
||||
toastError(error as string);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -132,9 +132,6 @@ export const changeUserInfo = async (userId: string, formData: FormData) => {
|
|||
newPassword,
|
||||
}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
return {error: response.statusText};
|
||||
}
|
||||
const data = await response.json();
|
||||
if (data.error) {
|
||||
return {error: data.error};
|
||||
|
|
|
|||
Loading…
Reference in New Issue