mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use Next.js 13 App directory
This commit is contained in:
parent
cb3fc9a488
commit
379a0e9859
28 changed files with 418 additions and 295 deletions
|
|
@ -1,51 +0,0 @@
|
|||
import Router from "next/router";
|
||||
import React from "react";
|
||||
import { Header } from "../components//UI/Header";
|
||||
import Layout from "../components//UI/Layout";
|
||||
import { Title } from "../components//UI/Elements/Styles/Title";
|
||||
import { loginAndGetToken } from "../services/auth/auth";
|
||||
|
||||
const Login = () => {
|
||||
const [email, setEmail] = React.useState("");
|
||||
const [password, setPassword] = React.useState("");
|
||||
|
||||
const handleSubmit = (e: any) => {
|
||||
e.preventDefault();
|
||||
console.log({ email, password });
|
||||
alert(JSON.stringify({ email, password }));
|
||||
try {
|
||||
loginAndGetToken(email, password);
|
||||
Router.push("/");
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
|
||||
const handleEmailChange = (e: any) => {
|
||||
setEmail(e.target.value);
|
||||
};
|
||||
|
||||
const handlePasswordChange = (e: any) => {
|
||||
setPassword(e.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Layout title="Login">
|
||||
<Header></Header>
|
||||
<Title>Login</Title>
|
||||
|
||||
<form>
|
||||
<input onChange={handleEmailChange} type="text" placeholder="email" />
|
||||
<input onChange={handlePasswordChange} type="password" placeholder="password" />
|
||||
<button onClick={handleSubmit} type="submit">
|
||||
Login
|
||||
</button>
|
||||
</form>
|
||||
</Layout>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Login;
|
||||
Loading…
Add table
Add a link
Reference in a new issue