"use client" import { useState } from "react" import strings from "@/strings.json" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Button } from "@/components/ui/button" import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" export default function CreateUser() { const [username, setUsername] = useState("") const [email, setEmail] = useState("") const [password, setPassword] = useState("") const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() try { const response = await fetch('http://localhost:3001/api/users/add', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ username, email, password }), }); if (!response.ok) { throw new Error(strings.errorsCreateUserFail); } const data = await response.json(); console.log(`${strings.successSuperGeneric}: ${data}`); } catch (error) { console.error(`${strings.errorsSuperGeneric}: ${error}`); } console.log({ username, email, password }) } return (

{strings.adminNewUserHeader}

{strings.newUserCardTitle}
setUsername(e.target.value)} placeholder={strings.newUserNameFieldPlaceholder} />
setEmail(e.target.value)} placeholder={strings.newUserEmailFieldPlaceholder} />
setPassword(e.target.value)} placeholder={strings.newUserPasswordFieldPlaceholder} />
) }