Removed unnecessary folders from git
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// components/Header.tsx
|
||||
import React from 'react';
|
||||
import Link from 'next/link';
|
||||
import MyUserButton from './MyUserButton';
|
||||
|
||||
const Header: React.FC = () => {
|
||||
return (
|
||||
@ -27,9 +28,7 @@ const Header: React.FC = () => {
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/account" className='hover:text-gray-400'>
|
||||
Account
|
||||
</Link>
|
||||
<MyUserButton />
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
@ -4,7 +4,7 @@ import { useState } from 'react';
|
||||
import { useRouter } from 'next/navigation'; // Use next/navigation for App Router
|
||||
|
||||
export default function LoginPage() {
|
||||
const [userInput, setUserInput] = useState(''); // Accept either username or email
|
||||
const [email, setEmail] = useState(''); // Accept email
|
||||
const [password, setPassword] = useState('');
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const router = useRouter();
|
||||
@ -19,7 +19,7 @@ export default function LoginPage() {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
user_input: userInput,
|
||||
email,
|
||||
password,
|
||||
}),
|
||||
});
|
||||
@ -44,9 +44,9 @@ export default function LoginPage() {
|
||||
<form onSubmit={handleSubmit}>
|
||||
<input
|
||||
type="text"
|
||||
value={userInput}
|
||||
onChange={(e) => setUserInput(e.target.value)}
|
||||
placeholder="Username or Email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
placeholder="Email"
|
||||
/>
|
||||
<input
|
||||
type="password"
|
||||
|
||||
@ -3,18 +3,20 @@
|
||||
import { useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import Link from 'next/link';
|
||||
import Input from '@/app/components/Input';
|
||||
|
||||
const RegisterPage = () => {
|
||||
const [role, setRole] = useState<'PRIVATE' | 'BUSINESS' | null>(null); // Initially, no role is selected
|
||||
const [name, setName] = useState('');
|
||||
const [company, setCompany] = useState('');
|
||||
const [address, setAddress] = useState('');
|
||||
const [postcode, setPostcode] = useState('');
|
||||
const [city, setCity] = useState('');
|
||||
const [phone, setPhone] = useState('');
|
||||
const [privatePhone, setPrivatePhone] = useState('');
|
||||
const [email, setEmail] = useState('');
|
||||
const [cvr, setCvr] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [username, setUsername] = useState('');
|
||||
const router = useRouter();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
@ -23,10 +25,11 @@ const RegisterPage = () => {
|
||||
const userData: any = {
|
||||
name,
|
||||
address,
|
||||
postcode,
|
||||
city,
|
||||
phone,
|
||||
email,
|
||||
password,
|
||||
username,
|
||||
role,
|
||||
};
|
||||
|
||||
@ -83,58 +86,48 @@ const RegisterPage = () => {
|
||||
{/* Registration Form */}
|
||||
{role && (
|
||||
<div className="bg-white p-8 rounded-lg shadow-md w-96">
|
||||
<h3 className="text-2xl font-bold mb-4">{role === 'PRIVATE' ? 'Private Registration' : 'Business Registration'}</h3>
|
||||
<h3 className="text-2xl font-bold mb-4">
|
||||
{role === 'PRIVATE' ? 'Private Registration' : 'Business Registration'}
|
||||
</h3>
|
||||
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="mb-4">
|
||||
<label htmlFor="name" className="block text-sm font-medium text-gray-700">Name</label>
|
||||
<input
|
||||
type="text"
|
||||
id="name"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<Input
|
||||
id="name"
|
||||
type="text"
|
||||
label="Name"
|
||||
required
|
||||
setChange={(e) => setName(e.target.value)}
|
||||
value={name}
|
||||
/>
|
||||
|
||||
{role === 'BUSINESS' && (
|
||||
<>
|
||||
<div className="mb-4">
|
||||
<label htmlFor="company" className="block text-sm font-medium text-gray-700">Company</label>
|
||||
<input
|
||||
type="text"
|
||||
id="company"
|
||||
value={company}
|
||||
onChange={(e) => setCompany(e.target.value)}
|
||||
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
|
||||
required={role === 'BUSINESS'}
|
||||
/>
|
||||
</div>
|
||||
<Input
|
||||
id="company"
|
||||
type="text"
|
||||
label="Company"
|
||||
required={role === 'BUSINESS'}
|
||||
setChange={(e) => setCompany(e.target.value)}
|
||||
value={company}
|
||||
/>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="privatePhone" className="block text-sm font-medium text-gray-700">Private Phone</label>
|
||||
<input
|
||||
type="text"
|
||||
id="privatePhone"
|
||||
value={privatePhone}
|
||||
onChange={(e) => setPrivatePhone(e.target.value)}
|
||||
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
|
||||
required={role === 'BUSINESS'}
|
||||
/>
|
||||
</div>
|
||||
<Input
|
||||
id="privatePhone"
|
||||
type="text"
|
||||
label="Private Phone"
|
||||
required={role === 'BUSINESS'}
|
||||
setChange={(e) => setPrivatePhone(e.target.value)}
|
||||
value={privatePhone}
|
||||
/>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="cvr" className="block text-sm font-medium text-gray-700">CVR</label>
|
||||
<input
|
||||
type="text"
|
||||
id="cvr"
|
||||
value={cvr}
|
||||
onChange={(e) => setCvr(e.target.value)}
|
||||
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
|
||||
required={role === 'BUSINESS'}
|
||||
/>
|
||||
</div>
|
||||
<Input
|
||||
id="cvr"
|
||||
type="text"
|
||||
label="CVR"
|
||||
required={role === 'BUSINESS'}
|
||||
setChange={(e) => setCvr(e.target.value)}
|
||||
value={cvr}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@ -150,6 +143,30 @@ const RegisterPage = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="postcode" className="block text-sm font-medium text-gray-700">Postcode</label>
|
||||
<input
|
||||
type="number"
|
||||
id="postcode"
|
||||
value={postcode}
|
||||
onChange={(e) => setPostcode(e.target.value)}
|
||||
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="city" className="block text-sm font-medium text-gray-700">City</label>
|
||||
<input
|
||||
type="text"
|
||||
id="city"
|
||||
value={city}
|
||||
onChange={(e) => setCity(e.target.value)}
|
||||
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="phone" className="block text-sm font-medium text-gray-700">Phone</label>
|
||||
<input
|
||||
@ -174,18 +191,6 @@ const RegisterPage = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="username" className="block text-sm font-medium text-gray-700">Username</label>
|
||||
<input
|
||||
type="text"
|
||||
id="username"
|
||||
value={username}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="password" className="block text-sm font-medium text-gray-700">Password</label>
|
||||
<input
|
||||
|
||||
Reference in New Issue
Block a user