Skip to content

Commit

Permalink
Merge pull request #2 from KDT5TeamWink/SeoDongUk
Browse files Browse the repository at this point in the history
[230612]1차PR-서동욱
  • Loading branch information
foodeco authored Jun 12, 2023
2 parents 3241d8b + f5ea74c commit 09a915f
Show file tree
Hide file tree
Showing 21 changed files with 705 additions and 522 deletions.
Binary file added public/images/carousel1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/carousel2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/carousel3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions src/Apis/productApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//import axios from '@/Apis/axios';
import axios from 'axios';

const { VITE_CLIENT_ID } = import.meta.env;
Expand All @@ -19,7 +18,7 @@ export async function getList(category: number) {
category: category,
},
});
console.log(data.products);
//console.log(data.products);
return data.products;
} catch (err) {
console.log(err);
Expand All @@ -34,3 +33,12 @@ export async function getRecommand() {
console.log(err);
}
}

export async function getDetail(product_no: string) {
try {
const res = await ajax.get(`/products/${product_no}`);
return res.data;
} catch (err) {
console.log(err);
}
}
11 changes: 6 additions & 5 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

body {
margin: 0;
// width: 100%;
// width: 100%;
//height: 100vh;
background-color: #F8EDE3;
background-color: #f8ede3;
//background-color: rebeccapurple;
// font-family: 'Dovemayo_gothic';
};
font-family: 'SUITE-Regular';
}

a {
text-decoration: none;
Expand All @@ -26,8 +27,8 @@ a {

@font-face {
font-family: 'SUITE-Regular';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUITE-Regular.woff2') format('woff2');
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUITE-Regular.woff2')
format('woff2');
font-weight: 400;
font-style: normal;
}

14 changes: 6 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import './App.scss'
import RoutesPage from 'routes/routes'


import './App.scss';
import RoutesPage from './routes/routes';

function App() {
return (
return (
<>
<RoutesPage/>
<RoutesPage />
</>
)
);
}

export default App
export default App;
124 changes: 63 additions & 61 deletions src/Common/Form/Login/login.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import './login.scss'
import './login.scss';
import { useNavigate, Link } from 'react-router-dom';
//import { useDispatch } from "react-redux";
import { FormEvent, useState, ChangeEvent } from 'react';
import { FormEvent, useState, ChangeEvent } from 'react';
//import { loginUser } from '_reducers/user_reducer';
import { LoginForm } from 'Apis/apis';
import { LoginForm } from '@/Apis/register';


function Login() {

const navigate = useNavigate();
//const dispatch = useDispatch();
const [email, setEmail] = useState<string>('');
const [password, setPassword] = useState<string>('');



const onChangeEmail = (e: ChangeEvent<HTMLInputElement>) => {
setEmail(e.target.value);
};
Expand All @@ -24,93 +20,99 @@ function Login() {
};

interface DataToSubmit {
email: string // 사용자 아이디 (필수!)
password: string // 사용자 비밀번호 (필수!)
email: string; // 사용자 아이디 (필수!)
password: string; // 사용자 비밀번호 (필수!)
}


async function Signin(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
if (email === undefined || email === "" || email === null) {

if (email === undefined || email === '' || email === null) {
alert('이메일을 입력해주세요.');
return false;
}
if (password === undefined || password === "" || password === null) {

if (password === undefined || password === '' || password === null) {
alert('비밀번호를 입력해주세요.');
return false;
}

const dataToSubmit: DataToSubmit = {
email: email,
password: password
password: password,
};

try {

//const data = await dispatch(loginUser(dataToSubmit));
const data = await LoginForm(email, password)
const data = await LoginForm(email, password);
console.log(data);

if(data.accessToken){
alert("로그인 되었습니다!");
if (data.accessToken) {
alert('로그인 되었습니다!');
window.localStorage.setItem('token', data.accessToken);
navigate("/");
navigate('/');
} else {
alert("로그인에 실패하였습니다. 다시 시도해주세요.");
alert('로그인에 실패하였습니다. 다시 시도해주세요.');
}
} catch (error) {
console.error(error);
alert("오류가 발생했습니다. 다시 시도해주세요.");
alert('오류가 발생했습니다. 다시 시도해주세요.');
}
}


return(
return (
<>
<div className="LoginContainer">
<form className="loginContainer-inner" onSubmit={Signin}>
<div className="JoinTextContainer">
<p>로그인</p>
</div>

<div className="formBox">
<div className='formBox-inner'>
<input
placeholder="이메일을 입력하세요"
autoComplete="off"
type='text'
name='email'
value={email}
onChange={onChangeEmail}
/>
<div className="LoginContainer">
<form className="loginContainer-inner" onSubmit={Signin}>
<div className="JoinTextContainer">
<p>로그인</p>
</div>

<div className='formBox-inner'>
<input
placeholder="비밀번호를 입력하세요"
autoComplete="off"
type='text'
name='password'
value={password}
onChange={onChangeName}
/>
</div>
<div className="formBox">
<div className="formBox-inner">
<input
placeholder="이메일을 입력하세요"
autoComplete="off"
type="text"
name="email"
value={email}
onChange={onChangeEmail}
/>
</div>

<div className='buttonContainer'>
<button className="buttonBox" type='submit'>등록</button>
<div className="formBox-inner">
<input
placeholder="비밀번호를 입력하세요"
autoComplete="off"
type="text"
name="password"
value={password}
onChange={onChangeName}
/>
</div>

<div className="buttonContainer">
<button className="buttonBox" type="submit">
등록
</button>
</div>
</div>
</div>
</form>
<div className='bottomText'>
<p>아이디가 없으신가요?</p>
<Link style={{ textDecoration: 'none', color: 'black', marginLeft:'20px' }} to="/join">
</form>
<div className="bottomText">
<p>아이디가 없으신가요?</p>
<Link
style={{
textDecoration: 'none',
color: 'black',
marginLeft: '20px',
}}
to="/join"
>
<p>회원가입 하러 가기!</p>
</Link>
</div>
</div>
</div>
</>
)
);
}
export default Login
export default Login;
Loading

0 comments on commit 09a915f

Please sign in to comment.