mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 17:18:23 +00:00
fix: oidc login failed message before redirect (#5648)
This commit is contained in:
parent
9c626df401
commit
19d002173f
2 changed files with 9 additions and 5 deletions
|
|
@ -14,8 +14,9 @@ function AuthOIDC(props: { oidcId: string; redirectToPath: string }) {
|
|||
if (!env.auth.oidc) {
|
||||
throw new Error('OIDC provider is not configured');
|
||||
}
|
||||
|
||||
await startAuthFlowForOIDCProvider(props.oidcId);
|
||||
// we need to return something, otherwise react-query will throw an error
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { CircleHelpIcon } from 'lucide-react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useSessionContext } from 'supertokens-auth-react/recipe/session';
|
||||
|
|
@ -102,11 +102,14 @@ export function AuthSSOPage(props: { redirectToPath: string }) {
|
|||
},
|
||||
disabled: sso.isPending,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
form.setFocus('slug', { shouldSelect: true });
|
||||
}, [sso.isPending]);
|
||||
const { toast } = useToast();
|
||||
|
||||
const onSubmit = useCallback(
|
||||
(data: SSOFormValues) => {
|
||||
sso.reset();
|
||||
sso.mutate({
|
||||
slug: data.slug,
|
||||
});
|
||||
|
|
@ -143,7 +146,7 @@ export function AuthSSOPage(props: { redirectToPath: string }) {
|
|||
<FormField
|
||||
control={form.control}
|
||||
name="slug"
|
||||
render={({ field }) => (
|
||||
render={() => (
|
||||
<FormItem>
|
||||
<FormLabel className="flex flex-row items-center gap-x-2">
|
||||
Organization slug{' '}
|
||||
|
|
@ -163,7 +166,7 @@ export function AuthSSOPage(props: { redirectToPath: string }) {
|
|||
</TooltipProvider>
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="acme" {...field} />
|
||||
<Input placeholder="acme" {...form.register('slug')} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
|
|||
Loading…
Reference in a new issue