it just works

This commit is contained in:
2023-01-12 23:18:50 +01:00
parent f8091b6d14
commit 5e3a40baf4
4 changed files with 18 additions and 6 deletions

View File

@@ -74,9 +74,12 @@ export default function Home({ socket }: Props) {
}, [])
useEffect(() => {
const interval = setInterval(() => client.running(), 1000)
return () => clearInterval(interval)
}, [])
if (status.connected) {
client.running()
const interval = setInterval(() => client.running(), 1000)
return () => clearInterval(interval)
}
}, [status.connected])
useEffect(() => {
client.freeSpace()
@@ -89,7 +92,7 @@ export default function Home({ socket }: Props) {
switch (typeof res.result) {
case 'object':
setActiveDownloads(
res.result
(res.result ?? [])
.filter((r: RPCResult) => !!r.info.url)
.sort((a: RPCResult, b: RPCResult) => a.info.title.localeCompare(b.info.title))
)

View File

@@ -1,6 +1,7 @@
export type RPCMethods =
| "Service.Exec"
| "Service.Kill"
| "Service.Clear"
| "Service.Running"
| "Service.KillAll"
| "Service.FreeSpace"