Skip to content

Commit ba42c17

Browse files
committed
WIP: working on ability to merge oidc with password auth account
1 parent 8c4b7c0 commit ba42c17

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

site/src/pages/UserSettingsPage/AccountPage/AccountPage.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,31 @@ import { AccountForm } from "../../../components/SettingsAccountForm/SettingsAcc
44
import { useAuth } from "components/AuthProvider/AuthProvider"
55
import { useMe } from "hooks/useMe"
66
import { usePermissions } from "hooks/usePermissions"
7+
import { SignInForm } from "components/SignInForm/SignInForm"
8+
import { retrieveRedirect } from "utils/redirect"
9+
import { useQuery } from "@tanstack/react-query"
10+
import { getAuthMethods } from "api/api"
711

812
export const AccountPage: FC = () => {
13+
const queryKey = ["get-auth-methods"]
14+
const {
15+
data: authMethodsData,
16+
error: authMethodsError,
17+
isLoading: authMethodsLoading,
18+
isFetched: authMethodsFetched,
19+
} = useQuery({
20+
queryKey,
21+
queryFn: getAuthMethods,
22+
})
23+
924
const [authState, authSend] = useAuth()
1025
const me = useMe()
1126
const permissions = usePermissions()
1227
const { updateProfileError } = authState.context
1328
const canEditUsers = permissions && permissions.updateUsers
29+
// Extra
30+
const redirectTo = retrieveRedirect(location.search)
31+
console.log(authState.context.data)
1432

1533
return (
1634
<Section title="Account" description="Update your account info">
@@ -29,6 +47,17 @@ export const AccountPage: FC = () => {
2947
})
3048
}}
3149
/>
50+
51+
<SignInForm
52+
authMethods={authMethodsData}
53+
redirectTo={redirectTo}
54+
isSigningIn={false}
55+
error={authMethodsError}
56+
onSubmit={(credentials: { email: string; password: string }) => {
57+
console.log(credentials)
58+
return
59+
}}
60+
></SignInForm>
3261
</Section>
3362
)
3463
}

0 commit comments

Comments
 (0)