Skip to content

Commit 188d28f

Browse files
committed
feat: post all params to backend
1 parent 7e2ba6f commit 188d28f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/global/support/user/api.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export type PostLoginProps = {
1212

1313
export type OauthLoginProps = {
1414
type: `${OAuthEnum}`;
15-
code: string;
1615
callbackUrl: string;
16+
props: Record<string, string>;
1717
} & TrackRegisterParams;
1818

1919
export type WxLoginProps = {

projects/app/src/pages/login/provider.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const provider = () => {
1919
const { initd, loginStore, setLoginStore } = useSystemStore();
2020
const { setUserInfo } = useUserStore();
2121
const router = useRouter();
22-
const { code, state, error } = router.query as { code: string; state: string; error?: string };
22+
const { state, error, ...props } = router.query as Record<string, string>;
2323
const { toast } = useToast();
2424

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

34-
const authCode = useCallback(
35-
async (code: string) => {
34+
const authProps = useCallback(
35+
async (props: Record<string, string>) => {
3636
try {
3737
const res = await oauthLogin({
3838
type: loginStore?.provider || OAuthEnum.sso,
39-
code,
39+
props,
4040
callbackUrl: `${location.origin}/login/provider`,
4141
inviterId: localStorage.getItem('inviterId') || undefined,
4242
bd_vid: sessionStorage.getItem('bd_vid') || undefined,
@@ -86,8 +86,8 @@ const provider = () => {
8686
return;
8787
}
8888

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

9292
if (isOauthLogging) return;
9393

@@ -107,10 +107,10 @@ const provider = () => {
107107
}, 1000);
108108
return;
109109
} else {
110-
authCode(code);
110+
authProps(props);
111111
}
112112
})();
113-
}, [initd, authCode, code, error, loginStore, loginStore?.state, router, state, t, toast]);
113+
}, [initd, authProps, error, loginStore, loginStore?.state, router, state, t, toast, props]);
114114

115115
return <Loading />;
116116
};

0 commit comments

Comments
 (0)