summaryrefslogtreecommitdiff
path: root/src/components/actiontest.tsx
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-05-15 10:13:00 +0700
committerpolwex <polwex@sortug.com>2025-05-15 10:13:00 +0700
commitd56594d3289002566f4653d607f0837befd65109 (patch)
treef69685b458419566a78727ce6a8cecd0cdc269a5 /src/components/actiontest.tsx
parent04509d9207603d9055cf022051763ec05c9214d6 (diff)
wtf man
Diffstat (limited to 'src/components/actiontest.tsx')
-rw-r--r--src/components/actiontest.tsx27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/components/actiontest.tsx b/src/components/actiontest.tsx
new file mode 100644
index 0000000..863f289
--- /dev/null
+++ b/src/components/actiontest.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import { testFn, testLogin } from "@/actions/test";
+import { useActionState, useState } from "react";
+
+export default function TestForm() {
+ const [state, formAction, isPending] = useActionState<number, FormData>(
+ testLogin,
+ 0,
+ );
+ return (
+ <form action={formAction}>
+ <p>State: {state}</p>
+ <label>
+ Username
+ <input type="text" placeholder="shadcn" name="username" />
+ </label>
+ <label className="flex justify-between">
+ <span>Password</span>
+ <input type="password" placeholder="..." name="password" />
+ </label>
+ <button type="submit" className="w-full">
+ Login
+ </button>
+ </form>
+ );
+}