mirror of
https://github.com/openziti/zrok.git
synced 2025-02-07 13:59:47 +01:00
reload after regenerate (#822)
This commit is contained in:
parent
5dc9d0d882
commit
1af626d2c4
@ -11,6 +11,7 @@ import useApiConsoleStore from "./model/store.ts";
|
||||
import TabularView from "./TabularView.tsx";
|
||||
import {Node} from "@xyflow/react";
|
||||
import {getMetadataApi} from "./model/api.ts";
|
||||
import {User} from "./model/user.ts";
|
||||
|
||||
interface ApiConsoleProps {
|
||||
logout: () => void;
|
||||
@ -18,6 +19,7 @@ interface ApiConsoleProps {
|
||||
|
||||
const ApiConsole = ({ logout }: ApiConsoleProps) => {
|
||||
const user = useApiConsoleStore((state) => state.user);
|
||||
const userRef = useRef<User>(user);
|
||||
const graph = useApiConsoleStore((state) => state.graph);
|
||||
const updateGraph = useApiConsoleStore((state) => state.updateGraph);
|
||||
const oldGraph = useRef<Graph>(graph);
|
||||
@ -65,7 +67,7 @@ const ApiConsole = ({ logout }: ApiConsoleProps) => {
|
||||
}, [handleKeyPress]);
|
||||
|
||||
const retrieveOverview = () => {
|
||||
getMetadataApi(user).overview()
|
||||
getMetadataApi(userRef.current).overview()
|
||||
.then(d => {
|
||||
let newVov = mergeGraph(oldGraph.current, user, d.accountLimited!, d);
|
||||
if(!nodesEqual(oldGraph.current.nodes, newVov.nodes)) {
|
||||
|
@ -22,6 +22,10 @@ const RegenerateAccountTokenModal = ({ close, isOpen, user }: RegenerateAccountT
|
||||
setChecked(!checkedRef.current);
|
||||
}
|
||||
|
||||
const reload = () => {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setChecked(false);
|
||||
setSuccessMessage(null);
|
||||
@ -38,9 +42,12 @@ const RegenerateAccountTokenModal = ({ close, isOpen, user }: RegenerateAccountT
|
||||
updateUser(newUser);
|
||||
localStorage.setItem("user", JSON.stringify(newUser));
|
||||
document.dispatchEvent(new Event("userUpdated"));
|
||||
setSuccessMessage(<Grid2 container sx={{ flexGrow: 1 }} alignItems="center">
|
||||
setSuccessMessage(<><Grid2 container sx={{ flexGrow: 1 }} alignItems="center">
|
||||
<Typography variant="h6" sx={{ mt: 2, p: 1 }}>Your new account token is: <code>{d.token}</code></Typography>
|
||||
</Grid2>);
|
||||
</Grid2>
|
||||
<Grid2 container sx={{ flexGrow: 1, p: 1 }} alignItems="center">
|
||||
<Button type="primary" variant="contained" onClick={reload}>Reload API Console</Button>
|
||||
</Grid2></>);
|
||||
})
|
||||
.catch(e => {
|
||||
e.response.json().then(ex => {
|
||||
|
Loading…
Reference in New Issue
Block a user