feat: add leaderboard category

This commit is contained in:
2024-08-09 20:33:07 +07:00
parent e8ed08d49b
commit a5cd6383f3
33 changed files with 744 additions and 277 deletions
+1
View File
@@ -46,6 +46,7 @@ export const useFetch = <T = any>(
}
} catch (err) {
setError(err instanceof Error ? err : new Error("Unknown error"));
setData(undefined);
} finally {
loadingRef.current = false;
setIsLoading(false);
-21
View File
@@ -1,21 +0,0 @@
import { useEffect, useState } from "react";
export const setHashUrl = (value: string) => {
history.replaceState(undefined, undefined as never, "#" + value);
window.dispatchEvent(new HashChangeEvent("hashchange"));
};
export const useHashUrl = () => {
const [value, setValue] = useState(location.hash.substring(1));
useEffect(() => {
const onHashChange = () => {
setValue(location.hash.substring(1));
};
window.addEventListener("hashchange", onHashChange);
return () => window.removeEventListener("hashchange", onHashChange);
}, []);
return value;
};