refactor: change UI of login/list and fix Api not being defined in context

This commit is contained in:
Prayag Prajapati committed 2024-11-20 11:16:22 +05:30
1 parent b0e08ce4bd
commit c8409d8a01
13 files changed
+243 -171

No files matched your search

+23
View File
@@ -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;
+1 -1
View File
@@ -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;