Skip to content

Commit

Permalink
fix api
Browse files Browse the repository at this point in the history
  • Loading branch information
doljko committed May 1, 2024
1 parent 4ecf2c8 commit 5308d75
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/features/Core/screens/ChatScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const ChatScreen = ({ route }) => {
const isSystem = message.type == 'log';
const user = isSystem ? { _id: index, name: 'System' } : { _id: index, name: message?.data?.sender?.name, avatar: message?.data?.sender?.avatar };

console.log('message.data.content', JSON.stringify(message));
return {
_id: message.data.id,
text: isSystem ? message.data.resolved_content : message.data.content,
Expand Down Expand Up @@ -115,8 +114,12 @@ const ChatScreen = ({ route }) => {
image: url.uri,
};

setMessages(previousMessages => GiftedChat.append(previousMessages, message));
const res = await axiosClient.post('files/upload', formData);

await adapter.post(`chat-channels/${channel?.id}/send-message`, { sender: participantId.id, content: res.data.file.original_filename });

setMessages(previousMessages => GiftedChat.append(previousMessages, message));

console.log('Upload response:', res.data);
} catch (error) {
console.error('Error uploading file:', error);
Expand Down

0 comments on commit 5308d75

Please sign in to comment.