repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #6 | const router = useRouter(); |
| #7 |
| #8 | useEffect(() => { |
| #9 | const fetchBots = async () => { |
| #10 | const response = await fetch("/api/get_bots"); |
| #11 | const data = await response.json(); |
| #12 | setBots(data); |
| #13 | }; |
| #14 | fetchBots(); |
| #15 | }, []); |
| #16 |
| #17 | const handleDeleteBot = async (event) => { |
| #18 | event.preventDefault(); |
| #19 | const selectedBotSlug = event.target.bot_name.value; |
| #20 | if (selectedBotSlug === "none") { |
| #21 | return; |
| #22 | } |
| #23 | const response = await fetch("/api/delete_bot", { |
| #24 | method: "POST", |
| #25 | body: JSON.stringify({ slug: selectedBotSlug }), |
| #26 | headers: { |
| #27 | "Content-Type": "application/json", |
| #28 | }, |
| #29 | }); |
| #30 |
| #31 | if (response.ok) { |
| #32 | router.reload(); |
| #33 | } |
| #34 | }; |
| #35 |
| #36 | return ( |
| #37 | <> |
| #38 | {bots.length !== 0 && ( |
| #39 | <div className="w-full"> |
| #40 | {/* Delete Bot */} |
| #41 | <h2 className="text-xl font-bold text-gray-800">DELETE BOTS</h2> |
| #42 | <form className="py-2" onSubmit={handleDeleteBot}> |
| #43 | <label className="block mb-2 text-sm font-medium text-gray-900"> |
| #44 | List of Bots |
| #45 | </label> |
| #46 | <div className="flex flex-col sm:flex-row gap-x-4 gap-y-4"> |
| #47 | <select |
| #48 | name="bot_name" |
| #49 | defaultValue="none" |
| #50 | className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" |
| #51 | > |
| #52 | <option value="none">Select a Bot</option> |
| #53 | {bots.map((bot) => ( |
| #54 | <option key={bot.slug} value={bot.slug}> |
| #55 | {bot.name} |
| #56 | </option> |
| #57 | ))} |
| #58 | </select> |
| #59 | <button |
| #60 | type="submit" |
| #61 | className="h-fit text-white bg-red-600 hover:bg-red-600/90 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center" |
| #62 | > |
| #63 | Delete |
| #64 | </button> |
| #65 | </div> |
| #66 | </form> |
| #67 | </div> |
| #68 | )} |
| #69 | </> |
| #70 | ); |
| #71 | } |
| #72 |