Update to TypeScript 4
This commit is contained in:
parent
0cd1362b05
commit
5a82dd6a18
8 changed files with 286 additions and 94 deletions
|
@ -20,6 +20,18 @@ export default () => {
|
|||
const setServerStatus = ServerContext.useStoreActions(actions => actions.status.setServerStatus);
|
||||
const { setInstance, setConnectionState } = ServerContext.useStoreActions(actions => actions.socket);
|
||||
|
||||
const updateToken = (uuid: string, socket: Websocket) => {
|
||||
if (updatingToken) return;
|
||||
|
||||
updatingToken = true;
|
||||
getWebsocketToken(uuid)
|
||||
.then(data => socket.setToken(data.token, true))
|
||||
.catch(error => console.error(error))
|
||||
.then(() => {
|
||||
updatingToken = false;
|
||||
});
|
||||
};
|
||||
|
||||
const connect = (uuid: string) => {
|
||||
const socket = new Websocket();
|
||||
|
||||
|
@ -73,18 +85,6 @@ export default () => {
|
|||
.catch(error => console.error(error));
|
||||
};
|
||||
|
||||
const updateToken = (uuid: string, socket: Websocket) => {
|
||||
if (updatingToken) return;
|
||||
|
||||
updatingToken = true;
|
||||
getWebsocketToken(uuid)
|
||||
.then(data => socket.setToken(data.token, true))
|
||||
.catch(error => console.error(error))
|
||||
.then(() => {
|
||||
updatingToken = false;
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
connected && setError('');
|
||||
}, [ connected ]);
|
||||
|
|
|
@ -24,7 +24,7 @@ const LazyCodemirrorEditor = lazy(() => import(/* webpackChunkName: "editor" */'
|
|||
|
||||
export default () => {
|
||||
const [ error, setError ] = useState('');
|
||||
const { action } = useParams();
|
||||
const { action } = useParams<{ action: 'new' | string }>();
|
||||
const [ loading, setLoading ] = useState(action === 'edit');
|
||||
const [ content, setContent ] = useState('');
|
||||
const [ modalVisible, setModalVisible ] = useState(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue