Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
leonitousconforti committed May 9, 2024
1 parent 491b2c1 commit 7ec9ee3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
7 changes: 0 additions & 7 deletions apps/trading-site/.env.example

This file was deleted.

2 changes: 1 addition & 1 deletion apps/trading-site/app/protected/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function ProtectedPage() {
function SignOut() {
return (
<form
action={async () => {
onSubmit={async () => {
"use server";
await signOut();
}}
Expand Down
6 changes: 3 additions & 3 deletions apps/trading-site/app/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Link from "next/link";
import { Form } from "app/form";
import { redirect } from "next/navigation";
import { createUser, getUser } from "app/db";
import { Form } from "app/form";
import { SubmitButton } from "app/submit-button";
import Link from "next/link";
import { redirect } from "next/navigation";

export default function Login() {
async function register(formData: FormData) {
Expand Down
16 changes: 9 additions & 7 deletions apps/trading-site/app/submit-button.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
"use client";

import { useFormStatus } from "react-dom";
// import { useFormStatus } from "react-dom";

export function SubmitButton({ children }: { children: React.ReactNode }) {
const { pending } = useFormStatus();
// const { pending } = useFormStatus();

return (
<button
type={pending ? "button" : "submit"}
aria-disabled={pending}
// type={pending ? "button" : "submit"}
type={"submit"}
// aria-disabled={pending}
className="flex h-10 w-full items-center justify-center rounded-md border text-sm transition-all focus:outline-none"
>
{children}
{pending && (
{/* {pending && (
<svg
className="animate-spin ml-2 h-4 w-4 text-black"
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -22,9 +23,10 @@ export function SubmitButton({ children }: { children: React.ReactNode }) {
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
</svg>
)}
)} */}
<span aria-live="polite" className="sr-only" role="status">
{pending ? "Loading" : "Submit form"}
{/* {pending ? "Loading" : "Submit form"} */}
{"Submit form"}
</span>
</button>
);
Expand Down

1 comment on commit 7ec9ee3

@vercel
Copy link

@vercel vercel bot commented on 7ec9ee3 May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.