mirror of
https://github.com/Qortal/qortal-mobile.git
synced 2025-03-15 04:12:32 +00:00
logout event
This commit is contained in:
parent
002b6695d8
commit
06b210fcbd
@ -1007,8 +1007,8 @@ function App() {
|
||||
.sendMessage("logout", {})
|
||||
.then((response) => {
|
||||
if (response) {
|
||||
resetAllStates();
|
||||
executeEvent("logout-event", {});
|
||||
resetAllStates();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { getBaseApiReactSocket, pauseAllQueues, resumeAllQueues } from '../../App';
|
||||
import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
|
||||
|
||||
export const WebSocketActive = ({ myAddress, setIsLoadingGroups }) => {
|
||||
const socketRef = useRef(null); // WebSocket reference
|
||||
@ -16,6 +17,18 @@ export const WebSocketActive = ({ myAddress, setIsLoadingGroups }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const logoutEventFunc = () => {
|
||||
forceCloseWebSocket()
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
subscribeToEvent("logout-event", logoutEventFunc);
|
||||
|
||||
return () => {
|
||||
unsubscribeFromEvent("logout-event", logoutEventFunc);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!myAddress) return; // Only proceed if myAddress is set
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user