refactor: move typed Redux hooks from src/store/hooks.ts to src/hooks/store.ts

Also update GitHub repository URLs and labels in hero layout.
This commit is contained in:
siujamo
2026-05-12 09:08:37 +08:00
parent b2fea5df8e
commit 4b9c7d3e0d
4 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ This is a Chinese-language SPA for browsing and managing Delta Force guide ("《
- `EmptyLayout` (minimal) for `/login`
All page components are lazy-loaded via `createBrowserRouter` + `lazy()`.
**State** (`src/store/`): Redux Toolkit with two slices — `auth` (current user) and `firearms` (paginated firearm list). State is persisted to `localStorage` or `sessionStorage` based on the `VITE_REDUX_STORAGE` env var. Use typed hooks from `src/store/hooks.ts` (`useAppDispatch`, `useAppSelector`).
**State** (`src/store/`): Redux Toolkit with two slices — `auth` (current user) and `firearms` (paginated firearm list). State is persisted to `localStorage` or `sessionStorage` based on the `VITE_REDUX_STORAGE` env var. Use typed hooks from `src/hooks/store.ts` (`useAppDispatch`, `useAppSelector`).
**API layer** (`src/api/`): Axios instance (`src/shared/web-client/`) with base URL from `VITE_API_BASE_URL`, 10s timeout, and credentials. API modules: `FirearmApi`, `ModificationApi`, `TagApi`, `AuthApi`.
+1 -2
View File
@@ -1,6 +1,5 @@
import { useDispatch, useSelector } from "react-redux"
import type { AppDispatch, RootState } from "./index"
import type { AppDispatch, RootState } from "@/store"
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
export const useAppSelector = useSelector.withTypes<RootState>()
+1 -1
View File
@@ -9,7 +9,7 @@ import {
LoginOutlined,
} from "@ant-design/icons"
import { AuthApi } from "@/api"
import { useAppDispatch, useAppSelector } from "@/store/hooks"
import { useAppDispatch, useAppSelector } from "@/hooks/store"
import { clearCurrentUser } from "@/store/auth-slice"
import { useState } from "react"
+1 -1
View File
@@ -2,7 +2,7 @@ import { useState } from "react"
import { useNavigate } from "react-router-dom"
import { App, Button, Card, Form, Input, Typography } from "antd"
import { AuthApi } from "@/api"
import { useAppDispatch } from "@/store/hooks"
import { useAppDispatch } from "@/hooks/store"
import { setCurrentUser } from "@/store/auth-slice"
import { LoginRequest } from "@/types"