diff --git a/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx b/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx index 8325d93e..585d1dbb 100644 --- a/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx +++ b/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx @@ -44,7 +44,7 @@ const EncryptedSocketChat: React.FC = ({ const { t } = useTranslation(); const theme = useTheme(); - const audio = new Audio(`/static/assets/sounds/chat-open.mp3`); + const [audio] = useState(() => new Audio(`/static/assets/sounds/chat-open.mp3`)); const [connected, setConnected] = useState(false); const [peerConnected, setPeerConnected] = useState(false); const [peerPubKey, setPeerPubKey] = useState(); diff --git a/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx b/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx index aeadce81..836e1126 100644 --- a/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx +++ b/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx @@ -43,7 +43,7 @@ const EncryptedTurtleChat: React.FC = ({ const { t } = useTranslation(); const theme = useTheme(); - const audio = new Audio(`/static/assets/sounds/chat-open.mp3`); + const [audio] = useState(() => new Audio(`/static/assets/sounds/chat-open.mp3`)); const [peerConnected, setPeerConnected] = useState(false); const [peerPubKey, setPeerPubKey] = useState(); const [value, setValue] = useState(''); diff --git a/frontend/src/contexts/AppContext.ts b/frontend/src/contexts/AppContext.ts index cf082170..35d5126e 100644 --- a/frontend/src/contexts/AppContext.ts +++ b/frontend/src/contexts/AppContext.ts @@ -294,10 +294,11 @@ export const useAppStore = () => { }; const fetchOrder = function () { - if (currentOrder != undefined) { + if (currentOrder) { apiClient .get(baseUrl, '/api/order/?order_id=' + currentOrder, { tokenSHA256: robot.tokenSHA256 }) - .then(orderReceived); + .then(orderReceived) + .catch(orderReceived); } };