diff --git a/src/App.tsx b/src/App.tsx
index a0b0e53..e9a6ca8 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,9 +1,18 @@
import { createContext } from 'react'
import RouterSetup from './RouterSetup'
+import { useSelector } from 'react-redux'
+import type { StoreType } from './stores'
+import Loading from './components/Loading'
export default function App() {
-
+ const userStore = useSelector((store: StoreType) => store.user)
+
return (
-
+ <>
+ {
+ userStore.loading ?
+ :
+ }
+ >
)
}
diff --git a/src/components/Loading.tsx b/src/components/Loading.tsx
new file mode 100644
index 0000000..a913a7a
--- /dev/null
+++ b/src/components/Loading.tsx
@@ -0,0 +1,22 @@
+import React from 'react'
+
+export default function Loading() {
+ return (
+
+
+
Đang tải dữ liệu xác thực...
+
+ )
+}
diff --git a/src/pages/admin/auth/ProtectedAdmin.tsx b/src/pages/admin/auth/ProtectedAdmin.tsx
index 6d0d254..38cda95 100644
--- a/src/pages/admin/auth/ProtectedAdmin.tsx
+++ b/src/pages/admin/auth/ProtectedAdmin.tsx
@@ -99,73 +99,8 @@ export default function ProtectedAdmin(
/* chưa vào case, default */
- return (
-
-
- {/* avatar skeleton + spinner */}
-
-
-
-
-
-
-
-
-
- Đang xác thực — kết nối tới máy chủ...
-
-
-
- {/* visually-hidden for screen readers */}
-
Loading authentication information
-
-
-
-
- )
-
async function signInHandle(e: FormEvent) {
e.preventDefault()
let data: UserSignInDTO = {
diff --git a/src/pages/home/auth/Auth.tsx b/src/pages/home/auth/Auth.tsx
index d23eec0..d7c5c4c 100644
--- a/src/pages/home/auth/Auth.tsx
+++ b/src/pages/home/auth/Auth.tsx
@@ -49,9 +49,9 @@ export default function Auth() {
console.log("loginData", loginData)
try {
let data = await Apis.user.signIn(loginData)
- localStorage.setItem("userLogin", data.data.id)
+ localStorage.setItem("token", data)
Modal.confirm({
- title: `Chào mừng ${data.data.userName} đã quay trở lại`,
+ title: `Chào mừng bạn đã quay trở lại`,
content: ``,
onOk: () => {
window.location.href = "/"