Skip to content

Commit

Permalink
Adjust message sent logic for NewMessageModal depending on page location
Browse files Browse the repository at this point in the history
  • Loading branch information
leekahung committed Dec 13, 2024
1 parent 9e11756 commit 5086a1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Modals/NewMessageModal.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// React Imports
import React, { useContext, useEffect, useState } from 'react';
import { useLocation } from 'react-router-dom';
// Inrupt Library Imports
import { useMessageList, useNotification, useSession, useContactsList } from '@hooks';
// Material UI Imports
Expand Down Expand Up @@ -46,6 +47,7 @@ const NewMessageModal = ({ showModal, setShowModal, oldMessage = '', toField = '
const { podUrl } = useContext(SignedInUserContext);
const { addNotification } = useNotification();
const [originalMessage, setOriginalMessage] = useState(oldMessage.message);
const location = useLocation();

const [message, setMessage] = useState({
recipientPodUrl:
Expand Down Expand Up @@ -111,7 +113,7 @@ const NewMessageModal = ({ showModal, setShowModal, oldMessage = '', toField = '
await sendMessageTTL(session, messageWithTrimmedInputs, podUrl);

setMessage({
recipientPodUrl: '',
recipientPodUrl: location.pathname === '/contacts' ? toField : '',
title: '',
message: ''
});
Expand Down

0 comments on commit 5086a1d

Please sign in to comment.