From 4e3cd10e6d771b1516781752c7d5612bee1131db Mon Sep 17 00:00:00 2001
From: 0fatal <2816813070@qq.com>
Date: Fri, 1 Sep 2023 10:55:32 +0000
Subject: [PATCH] fix(web): fix miss getting providers
---
web/src/layouts/Basic/index.tsx | 1 +
web/src/pages/app/setting/UserInfo/index.tsx | 7 ++++++-
web/src/pages/auth/signin/index.tsx | 8 +++++---
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/web/src/layouts/Basic/index.tsx b/web/src/layouts/Basic/index.tsx
index cd9153603e..532fa849ef 100644
--- a/web/src/layouts/Basic/index.tsx
+++ b/web/src/layouts/Basic/index.tsx
@@ -26,6 +26,7 @@ export default function BasicLayout() {
useEffect(() => {
init();
}, [init]);
+
return (
diff --git a/web/src/pages/app/setting/UserInfo/index.tsx b/web/src/pages/app/setting/UserInfo/index.tsx
index aa413e5b64..ebd581605f 100644
--- a/web/src/pages/app/setting/UserInfo/index.tsx
+++ b/web/src/pages/app/setting/UserInfo/index.tsx
@@ -15,6 +15,7 @@ import UsernameEditor from "./Mods/UsernameEditor";
import "react-image-crop/dist/ReactCrop.css";
+import { useGetProvidersQuery } from "@/pages/auth/service";
import useAuthStore from "@/pages/auth/store";
import useGlobalStore from "@/pages/globalStore";
import useSiteSettingStore from "@/pages/siteSetting";
@@ -27,7 +28,11 @@ export default function UserInfo() {
const { colorMode } = useColorMode();
const darkMode = colorMode === "dark";
const { siteSettings } = useSiteSettingStore((state) => state);
- const { providers } = useAuthStore((state) => state);
+ const { providers, setProviders } = useAuthStore((state) => state);
+
+ useGetProvidersQuery((data: any) => {
+ setProviders(data?.data || []);
+ });
const handleClick = () => {
if (fileInputRef.current) {
diff --git a/web/src/pages/auth/signin/index.tsx b/web/src/pages/auth/signin/index.tsx
index 6feee5cbfe..9612158666 100644
--- a/web/src/pages/auth/signin/index.tsx
+++ b/web/src/pages/auth/signin/index.tsx
@@ -19,14 +19,16 @@ export default function SignIn() {
const { colorMode } = useColorMode();
const darkMode = colorMode === COLOR_MODE.dark;
const { providers, setProviders } = useAuthStore();
- useGetProvidersQuery((data: any) => {
- setProviders(data?.data || []);
- });
const [phoneProvider, setPhoneProvider] = useState
(null);
const [passwordProvider, setPasswordProvider] = useState(null);
const [githubProvider, setGithubProvider] = useState(null);
const [wechatProvider, setWechatProvider] = useState(null);
const [currentProvider, setCurrentProvider] = useState();
+
+ useGetProvidersQuery((data: any) => {
+ setProviders(data?.data || []);
+ });
+
useEffect(() => {
if (providers.length) {
const phoneProvider = providers.find((provider: any) => provider.name === "phone");