diff --git a/src/components/index.ts b/src/components/index.ts
index d36abe7..114c892 100755
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -5,5 +5,15 @@ import VolunteerSet from "./VolunteerSet"
import ErrorBoundary from "./ErrorBoundary"
import Loading from "./Loading"
import WishAdd from "./WishAdd"
+import RegisterForm from "./RegisterForm"
-export { VolunteerList, JavGameList, VolunteerInfo, VolunteerSet, ErrorBoundary, Loading, WishAdd }
+export {
+ VolunteerList,
+ JavGameList,
+ VolunteerInfo,
+ VolunteerSet,
+ ErrorBoundary,
+ Loading,
+ WishAdd,
+ RegisterForm,
+}
diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx
index 0b261cc..aeabd4f 100755
--- a/src/pages/Home/Home.tsx
+++ b/src/pages/Home/Home.tsx
@@ -50,10 +50,6 @@ const Home: FC
= (): JSX.Element => {
}
// Fetch server-side data here
-export const loadData = (): AppThunk[] => [
- fetchWishListIfNeed(),
- fetchJavGameListIfNeed(),
- // More pre-fetched actions...
-]
+export const loadData = (): AppThunk[] => [fetchWishListIfNeed(), fetchJavGameListIfNeed()]
export default memo(Home)
diff --git a/src/pages/Register/RegisterPage.tsx b/src/pages/Register/RegisterPage.tsx
index 539917f..f2ffd66 100644
--- a/src/pages/Register/RegisterPage.tsx
+++ b/src/pages/Register/RegisterPage.tsx
@@ -1,22 +1,48 @@
+import { FC, useEffect, memo } from "react"
import { RouteComponentProps } from "react-router-dom"
-import { useDispatch } from "react-redux"
-import { FC, memo } from "react"
+import { useDispatch, useSelector, shallowEqual } from "react-redux"
import { Helmet } from "react-helmet"
+
+import { AppState, AppThunk, ValueRequest } from "../../store"
+import { fetchPreVolunteerCountIfNeed } from "../../store/preVolunteerCount"
+import { RegisterForm } from "../../components"
import styles from "./styles.module.scss"
-import RegisterForm from "../../components/RegisterForm/RegisterForm"
export type Props = RouteComponentProps
-const RegisterPage: FC = (): JSX.Element => {
+function useList(
+ stateToProp: (state: AppState) => ValueRequest,
+ fetchDataIfNeed: () => AppThunk
+) {
const dispatch = useDispatch()
- return (
-
- )
+ const { readyStatus, value } = useSelector(stateToProp, shallowEqual)
+
+ // Fetch client-side data here
+ useEffect(() => {
+ dispatch(fetchDataIfNeed())
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [dispatch])
+
+ return () => {
+ if (!readyStatus || readyStatus === "idle" || readyStatus === "request")
+ return Loading...
+
+ if (readyStatus === "failure") return Oops, Failed to load!
+
+ return
+ }
}
+const RegisterPage: FC = (): JSX.Element => (
+
+
+
+ {useList((state: AppState) => state.preVolunteerCount, fetchPreVolunteerCountIfNeed)()}
+
+
+)
+
+// Fetch server-side data here
+export const loadData = (): AppThunk[] => [fetchPreVolunteerCountIfNeed()]
+
export default memo(RegisterPage)
diff --git a/src/server/gsheets/accessors.ts b/src/server/gsheets/accessors.ts
index 769d8d0..60efa5e 100644
--- a/src/server/gsheets/accessors.ts
+++ b/src/server/gsheets/accessors.ts
@@ -8,7 +8,7 @@ import { GoogleSpreadsheet, GoogleSpreadsheetWorksheet } from "google-spreadshee
const CRED_PATH = path.resolve(process.cwd(), "access/gsheets.json")
-const REMOTE_SAVE_DELAY = 20000
+const REMOTE_UPDATE_DELAY = 20000
export type ElementWithId = { id: number } & ElementNoId
@@ -32,7 +32,7 @@ setInterval(
Object.values(sheetList).forEach((sheet: Sheet