mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-23 18:54:21 +01:00
wip: zen
This commit is contained in:
@@ -52,8 +52,8 @@ const createKey = action(async (form: FormData) => {
|
|||||||
await withActor(
|
await withActor(
|
||||||
() =>
|
() =>
|
||||||
Key.create({ name })
|
Key.create({ name })
|
||||||
.then((data) => ({ data }))
|
.then((data) => ({ error: undefined, data }))
|
||||||
.catch((e) => ({ error: e.message })),
|
.catch((e) => ({ error: e.message as string })),
|
||||||
workspaceID,
|
workspaceID,
|
||||||
),
|
),
|
||||||
{ revalidate: listKeys.key },
|
{ revalidate: listKeys.key },
|
||||||
@@ -193,8 +193,7 @@ function KeyCreateForm() {
|
|||||||
let input: HTMLInputElement
|
let input: HTMLInputElement
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
// @ts-expect-error
|
if (!submission.pending && submission.result && !submission.result.error) {
|
||||||
if (!submission.pending && submission.result?.data) {
|
|
||||||
hide()
|
hide()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -205,7 +204,7 @@ function KeyCreateForm() {
|
|||||||
// 2. Put in a key name and creates the key => form hides
|
// 2. Put in a key name and creates the key => form hides
|
||||||
// 3. Click add key button again => form shows with the same error if
|
// 3. Click add key button again => form shows with the same error if
|
||||||
// submission.clear() is called only once
|
// submission.clear() is called only once
|
||||||
for (let i = 0; i < 3; i++) {
|
while (true) {
|
||||||
submission.clear()
|
submission.clear()
|
||||||
if (!submission.result) break
|
if (!submission.result) break
|
||||||
}
|
}
|
||||||
@@ -229,10 +228,8 @@ function KeyCreateForm() {
|
|||||||
<form action={createKey} method="post" data-slot="create-form">
|
<form action={createKey} method="post" data-slot="create-form">
|
||||||
<div data-slot="input-container">
|
<div data-slot="input-container">
|
||||||
<input ref={(r) => (input = r)} data-component="input" name="name" type="text" placeholder="Enter key name" />
|
<input ref={(r) => (input = r)} data-component="input" name="name" type="text" placeholder="Enter key name" />
|
||||||
{/* @ts-expect-error */}
|
<Show when={submission.result && submission.result.error}>
|
||||||
<Show when={submission.result?.error}>
|
{(err) => <div data-slot="form-error">{err()}</div>}
|
||||||
{/* @ts-expect-error */}
|
|
||||||
<div data-slot="form-error">{submission.result.error}</div>
|
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="workspaceID" value={params.id} />
|
<input type="hidden" name="workspaceID" value={params.id} />
|
||||||
|
|||||||
Reference in New Issue
Block a user