From edbb93c03bc1e2a77187bf2f776664663c45c73d Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Tue, 18 Feb 2025 09:29:02 +0100 Subject: [PATCH] NORY-46: remove owner autofill --- .../src/components/forms/client-form.tsx | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/dashboard/src/components/forms/client-form.tsx b/dashboard/src/components/forms/client-form.tsx index afaca44..b4191d9 100644 --- a/dashboard/src/components/forms/client-form.tsx +++ b/dashboard/src/components/forms/client-form.tsx @@ -7,12 +7,11 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { Button } from '@/components/ui/button'; -import { kratos } from '@/ory'; -import { useEffect, useState } from 'react'; -import { Identity, OAuth2Client } from '@ory/client'; +import { useState } from 'react'; +import { OAuth2Client } from '@ory/client'; import { AxiosResponse } from 'axios'; import { AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog'; -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { useRouter } from 'next/navigation'; import { Checkbox } from '@/components/ui/checkbox'; @@ -23,13 +22,6 @@ interface CreateClientFormProps { export function CreateClientForm({ action }: CreateClientFormProps) { const router = useRouter(); - const [identity, setIdentity] = useState(); - - useEffect(() => { - kratos.toSession() - .then(response => response.data) - .then(session => setIdentity(session.identity)); - }, []); const form = useForm>({ resolver: zodResolver(clientFormSchema), @@ -61,10 +53,6 @@ export function CreateClientForm({ action }: CreateClientFormProps) { }); }; - useEffect(() => { - form.setValue('owner', identity?.id ?? ''); - }, [identity]); - return ( <> { @@ -180,7 +168,8 @@ export function CreateClientForm({ action }: CreateClientFormProps) { /> - )}/> + )} + /> { !form.getValues('skip') && ( <> @@ -199,7 +188,8 @@ export function CreateClientForm({ action }: CreateClientFormProps) { - )}/> + )} + /> - )}/> + )} + /> - )}/> + )} + /> Owner - + Owner is a string identifying the owner of the OAuth 2.0 Client.