This commit is contained in:
Martin McKeaveney 2021-02-15 18:59:21 +00:00
parent 55f98e82d8
commit 5d5637571b
3 changed files with 15 additions and 17 deletions

View File

@ -23,8 +23,8 @@
<!-- Builds Objects with Key Value Pairs. Useful for building things like Request Headers. -->
<div class="container">
{#each fields as field, idx}
<Input outline thin bind:value={field.name} />
<Input outline bind:value={field.value} />
<Input placeholder="Key" outline thin bind:value={field.name} />
<Input placeholder="Value" outline thin bind:value={field.value} />
<i class="ri-close-circle-fill" on:click={() => deleteEntry(idx)} />
{/each}
</div>
@ -36,6 +36,7 @@
grid-template-columns: 1fr 1fr 20px;
grid-gap: var(--spacing-m);
align-items: center;
margin-bottom: var(--spacing-m);
}
.ri-close-circle-fill,

View File

@ -19,11 +19,6 @@
$: fieldKeys = Object.keys(fields)
$: schemaKeys = Object.keys(schema.fields)
$: console.log({
fields,
schema
})
function updateCustomFields({ detail }) {
fields.customData = detail.value
}
@ -34,15 +29,19 @@
<div class="field">
{#each schemaKeys as field}
{#if schema.fields[field]?.type === "object"}
<div>
<Label extraSmall grey>{field}</Label>
<KeyValueBuilder bind:object={fields[field]} />
</div>
{:else if schema.fields[field]?.type === "json"}
<div>
<Label extraSmall grey>{field}</Label>
<Editor
mode="json"
on:change={({ detail }) => fields[field] = detail.value}
readOnly={!editable}
value={fields[field]} />
</div>
{:else}
<Input
label={field}

View File

@ -53,8 +53,6 @@ router.use(async (ctx, next) => {
router.get("/health", ctx => (ctx.status = 200))
router.post("/yeet", ctx => (ctx.body = ctx.request.body))
router.use(authRoutes.routes())
router.use(authRoutes.allowedMethods())