Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): fix miss getting providers #1513

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(web): fix miss getting providers
  • Loading branch information
0fatal committed Sep 1, 2023
commit 4e3cd10e6d771b1516781752c7d5612bee1131db
1 change: 1 addition & 0 deletions web/src/layouts/Basic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function BasicLayout() {
useEffect(() => {
init();
}, [init]);

return (
<div>
<Header className="m-auto max-w-screen-xl" />
Expand Down
7 changes: 6 additions & 1 deletion web/src/pages/app/setting/UserInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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) {
Expand Down
8 changes: 5 additions & 3 deletions web/src/pages/auth/signin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>(null);
const [passwordProvider, setPasswordProvider] = useState<any>(null);
const [githubProvider, setGithubProvider] = useState<any>(null);
const [wechatProvider, setWechatProvider] = useState<any>(null);
const [currentProvider, setCurrentProvider] = useState<providersTypes>();

useGetProvidersQuery((data: any) => {
setProviders(data?.data || []);
});

useEffect(() => {
if (providers.length) {
const phoneProvider = providers.find((provider: any) => provider.name === "phone");
Expand Down