[Update] Config Page: Supporters: Update-able anytime.

Fetch the supporters data and images from the git repo, https://github.com/ShiinaSakamoto/vrct_supporters, via web.
This commit is contained in:
Sakamoto Shiina
2025-02-03 11:26:10 +09:00
parent 182c277ef5
commit 4fb675943f
57 changed files with 335 additions and 562 deletions

View File

@@ -56,5 +56,9 @@ export { useHotkeys } from "./hotkeys/useHotkeys";
export { useOscIpAddress } from "./advanced_settings/useOscIpAddress";
export { useOscPort } from "./advanced_settings/useOscPort";
export { useSupporters } from "./supporters/useSupporters";
export { useSettingBoxScrollPosition } from "./useSettingBoxScrollPosition";
export { useSoftwareVersion } from "./useSoftwareVersion";

View File

@@ -0,0 +1,29 @@
import { useStore_SupportersData } from "@store";
import { supporters_data_url } from "@ui_configs";
export const useSupporters = () => {
const { currentSupportersData, updateSupportersData, pendingSupportersData, errorSupportersData } = useStore_SupportersData();
const asyncFetchSupportersData = async () => {
if (currentSupportersData.state === "pending") return;
pendingSupportersData();
try {
const res = await fetch(supporters_data_url);
// const res = await fetch(supporters_data_url, { cache: "no-store" });
if (!res.ok) {
throw new Error("Network response was not ok");
}
const data = await res.json();
updateSupportersData(data);
} catch (error) {
console.error("Error fetching supporters' data:", error);
errorSupportersData();
}
};
return {
asyncFetchSupportersData,
currentSupportersData,
updateSupportersData,
pendingSupportersData,
};
};