Reconnect to websocket on access_token change

This commit is contained in:
Minei3oat
2025-10-02 23:10:26 +02:00
parent c726855b1c
commit 0c5a681f5b
2 changed files with 3 additions and 18 deletions

View File

@@ -13,7 +13,7 @@ import { Firewall } from './pages/Firewall';
import { useQueryClient } from '@tanstack/react-query';
import NFProxy from './pages/NFProxy';
import ServiceDetailsNFProxy from './pages/NFProxy/ServiceDetails';
import { useAuth } from './js/store';
import { useAuthStore } from './js/store';
function App() {
@@ -23,7 +23,7 @@ function App() {
const [error, setError] = useState<string|null>()
const [loadinBtn, setLoadingBtn] = useState(false);
const queryClient = useQueryClient()
const { isAuthenticated, access_token } = useAuth()
const { access_token } = useAuthStore()
useEffect(()=>{
socketio.auth = { token: access_token || "" }
@@ -43,7 +43,7 @@ function App() {
socketio.off("connect_error")
socketio.disconnect()
}
},[isAuthenticated])
},[access_token])
const getStatus = () =>{
getstatus().then( res =>{