atproto explorer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix create record submission

Juliet 900f3887 a3377067

+8 -10
+8 -10
src/components/create.tsx
··· 4 4 import { Editor } from "../components/editor.jsx"; 5 5 import { editor } from "monaco-editor"; 6 6 import { theme } from "../components/settings.jsx"; 7 - import { action, redirect } from "@solidjs/router"; 8 7 import { ComAtprotoRepoCreateRecord } from "@atcute/client/lexicons"; 9 8 import Tooltip from "./tooltip.jsx"; 10 9 ··· 13 12 const [openCreate, setOpenCreate] = createSignal(false); 14 13 const [createNotice, setCreateNotice] = createSignal(""); 15 14 let model: editor.IModel; 15 + let formRef!: HTMLFormElement; 16 + 16 17 const placeholder = (date: string) => { 17 18 return { 18 19 $type: "app.bsky.feed.post", ··· 38 39 39 40 onCleanup(() => window.removeEventListener("keydown", keyEvent)); 40 41 41 - const createRecord = action(async (formData: FormData) => { 42 + const createRecord = async (formData: FormData) => { 42 43 const rpc = new XRPC({ handler: agent }); 43 44 const collection = formData.get("collection"); 44 45 const rkey = formData.get("rkey"); ··· 63 64 return; 64 65 } 65 66 setOpenCreate(false); 66 - throw redirect(`/${res.data.uri}`); 67 - }); 67 + window.location.href = `/${res.data.uri}`; 68 + }; 68 69 69 70 createEffect(() => { 70 71 if (openCreate()) document.body.style.overflow = "hidden"; ··· 89 90 > 90 91 <div class="dark:bg-dark-400 rounded-md border border-slate-900 bg-slate-100 p-4 text-slate-900 dark:border-slate-100 dark:text-slate-100"> 91 92 <h3 class="mb-2 text-lg font-bold">Creating record</h3> 92 - <form 93 - class="flex flex-col gap-y-3" 94 - action={createRecord} 95 - method="post" 96 - > 93 + <form ref={formRef} class="flex flex-col gap-y-3"> 97 94 <div class="flex w-fit flex-col gap-y-3"> 98 95 <div class="flex items-center gap-x-2"> 99 96 <label for="collection" class="min-w-20 select-none"> ··· 151 148 Close 152 149 </button> 153 150 <button 154 - type="submit" 151 + type="button" 152 + onclick={() => createRecord(new FormData(formRef))} 155 153 class="rounded-lg bg-green-500 px-2.5 py-1.5 text-sm font-bold text-slate-100 hover:bg-green-400 focus:outline-none focus:ring-1 focus:ring-slate-700 dark:bg-green-600 dark:hover:bg-green-500 dark:focus:ring-slate-300" 156 154 > 157 155 Create