diff --git a/src/components/user/User.tsx b/src/components/user/User.tsx index 05b86a0..a0013ed 100644 --- a/src/components/user/User.tsx +++ b/src/components/user/User.tsx @@ -94,31 +94,14 @@ const User: Component = (props) => { return errors; }; + const credentials = adminCredentials(); + const { database } = credentials || { database: null }; + const { form, data, setData, setInitialValues, reset } = createForm({ onSubmit: submitHandler, extend: reporter(), validate: validationHandler, - initialValues: getValues(), - }); - - createEffect(() => { - console.log({ caller: 'user / createEffect', values: getValues() }); - if (isNew()) { - const credentials = adminCredentials(); - if (!credentials) { - return; - } - const { database } = credentials; - setData('database', database); - } else { - setInitialValues(getValues()); - reset(); - console.log({ - caller: 'user / createEffect', - values: getValues(), - data: data(), - }); - } + initialValues: getValues() || { database }, }); const createUserHandler = async () => { diff --git a/src/routes/user/[id].tsx b/src/routes/user/[id].tsx index 0d58370..13430ec 100644 --- a/src/routes/user/[id].tsx +++ b/src/routes/user/[id].tsx @@ -1,6 +1,6 @@ import { useParams } from 'solid-start'; import User from '~/components/user'; -import { createEffect, createSignal } from 'solid-js'; +import { createEffect, createSignal, Show } from 'solid-js'; import { adminCredentials, CheckCredentials } from '~/components/credentials'; import { get } from '~/lib/get'; @@ -23,7 +23,9 @@ export default () => {

User

- + + +
);