refactor: change UI of login/list and fix Api not being defined in context
This commit is contained in:
13 files changed
+243
-171
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
function useInterval(callback: () => void, delay) {
|
||||
const savedCallback = useRef(null);
|
||||
|
||||
// Remember the latest callback.
|
||||
useEffect(() => {
|
||||
savedCallback.current = callback;
|
||||
}, [callback]);
|
||||
|
||||
// Set up the interval.
|
||||
useEffect(() => {
|
||||
function tick() {
|
||||
savedCallback.current();
|
||||
}
|
||||
if (delay !== null) {
|
||||
const id = setInterval(tick, delay);
|
||||
return () => clearInterval(id);
|
||||
}
|
||||
}, [delay]);
|
||||
}
|
||||
|
||||
export default useInterval;
|
||||
@@ -11,7 +11,7 @@ import axios from "axios";
|
||||
import axiosTauriApiAdapter from "axios-tauri-api-adapter";
|
||||
|
||||
type ApiStore = {
|
||||
api: Api;
|
||||
api: Api | undefined;
|
||||
deviceId: string | null;
|
||||
jellyfin: Jellyfin;
|
||||
createApi: (serverAddress: string, accessToken?: string | undefined) => void;
|
||||
|
||||
Reference in new issue
Block a user