Skip to content
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
2 changes: 1 addition & 1 deletion packages/global/support/user/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export type PostLoginProps = {

export type OauthLoginProps = {
type: `${OAuthEnum}`;
code: string;
callbackUrl: string;
props: Record<string, string>;
} & TrackRegisterParams;

export type WxLoginProps = {
Expand Down
16 changes: 8 additions & 8 deletions projects/app/src/pages/login/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const provider = () => {
const { initd, loginStore, setLoginStore } = useSystemStore();
const { setUserInfo } = useUserStore();
const router = useRouter();
const { code, state, error } = router.query as { code: string; state: string; error?: string };
const { state, error, ...props } = router.query as Record<string, string>;
const { toast } = useToast();

const loginSuccess = useCallback(
Expand All @@ -31,12 +31,12 @@ const provider = () => {
[setUserInfo, router, loginStore?.lastRoute]
);

const authCode = useCallback(
async (code: string) => {
const authProps = useCallback(
async (props: Record<string, string>) => {
try {
const res = await oauthLogin({
type: loginStore?.provider || OAuthEnum.sso,
code,
props,
callbackUrl: `${location.origin}/login/provider`,
inviterId: localStorage.getItem('inviterId') || undefined,
bd_vid: sessionStorage.getItem('bd_vid') || undefined,
Expand Down Expand Up @@ -86,8 +86,8 @@ const provider = () => {
return;
}

console.log('SSO', { initd, loginStore, code, state });
if (!code || !initd) return;
console.log('SSO', { initd, loginStore, props, state });
if (!props || !initd) return;

if (isOauthLogging) return;

Expand All @@ -107,10 +107,10 @@ const provider = () => {
}, 1000);
return;
} else {
authCode(code);
authProps(props);
}
})();
}, [initd, authCode, code, error, loginStore, loginStore?.state, router, state, t, toast]);
}, [initd, authProps, error, loginStore, loginStore?.state, router, state, t, toast, props]);

return <Loading />;
};
Expand Down
Loading