fix image url when using different host
This commit is contained in:
parent
37181d714a
commit
f878fe314d
|
|
@ -3,6 +3,7 @@ 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 {
|
||||||
|
|
@ -10,6 +11,14 @@ 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);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue