Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7주차] REDDI 미션 제출합니다. #6

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
9f1bd97
init: initial setting
leejin-rho Nov 27, 2023
54a8a25
feat: 페이지 구조 세팅
dhshin98 Nov 27, 2023
a14cbe0
feat: Layout setting
dhshin98 Nov 27, 2023
2993753
feat: 디렉토리 정리
dhshin98 Nov 28, 2023
b12fc10
style: loginBox, 이미지 위치 조정
leejin-rho Dec 12, 2023
f11c617
fix: 버튼 height 수정
leejin-rho Dec 14, 2023
08b0c02
feat: home 화면 스타일링, link 설정
leejin-rho Dec 15, 2023
6d889b7
fix: link 연결 버튼 수정, 투표 전 페이지 구현
leejin-rho Dec 15, 2023
fc521d5
Merge pull request #1 from team-REDDI/feature/2-vote-page
leejin-rho Dec 15, 2023
d820418
style: team, part 기본 스타일 구현
leejin-rho Dec 16, 2023
0e29eb4
style: result페이지 디자인 구현
leejin-rho Dec 16, 2023
1bffba5
fix: result 페이지 간격 수정
leejin-rho Dec 17, 2023
4d5744f
feat: result page router연결
leejin-rho Dec 17, 2023
fc51b1e
feat: part, team router 연결
leejin-rho Dec 17, 2023
657ac70
feat: login & signup 페이지 구성
dhshin98 Dec 20, 2023
9762af3
style: clicked style 추가
leejin-rho Dec 20, 2023
bc82342
feat: part 투표
leejin-rho Dec 20, 2023
6bb577a
Merge pull request #2 from team-REDDI/feature/3-part-vote-page
leejin-rho Dec 20, 2023
5f5c620
Merge pull request #3 from team-REDDI/feature/1-login-page
dhshin98 Dec 21, 2023
2384dd4
feat: 로고 클릭시 home 페이지로
dhshin98 Dec 21, 2023
680e10a
feat: 로그인 상태 확인
dhshin98 Dec 22, 2023
b2eee5d
feat: 회원가입 후 로그인페이지로 라우팅
dhshin98 Dec 22, 2023
02f64c8
feat: 로그아웃 버튼
dhshin98 Dec 22, 2023
a53db24
Merge pull request #4 from team-REDDI/feature/1-login-page
dhshin98 Dec 22, 2023
2c8fadd
feat: baseURL 추가
leejin-rho Dec 24, 2023
40d2e8f
feat: project result get api 연결
leejin-rho Dec 24, 2023
f498b2a
Merge pull request #5 from team-REDDI/feature/4-vote-api
leejin-rho Dec 24, 2023
68fd7fd
fix: team결과 style 수정
leejin-rho Dec 25, 2023
a0c218b
feat: front, back result API 연결
leejin-rho Dec 25, 2023
1370cbd
feat: team, part voteList api연결
leejin-rho Dec 25, 2023
d4075c7
feat: 회원가입 연동
dhshin98 Dec 25, 2023
f9ebb07
feat: 로그인 연동
dhshin98 Dec 26, 2023
260497d
feat: 로그인 후 userdata 저장
dhshin98 Dec 26, 2023
851ea49
Merge pull request #6 from team-REDDI/feature/5-auth-api
dhshin98 Dec 26, 2023
6099cda
feat: voteAPI추가
leejin-rho Dec 26, 2023
6a29e8d
Merge pull request #7 from team-REDDI/feature/4-vote-api
leejin-rho Dec 26, 2023
a5148ba
fix: isClicked 하나만 되게 수정
leejin-rho Dec 26, 2023
24dd70e
feat: post api
leejin-rho Dec 26, 2023
0d0b200
feat: 비밀번호 제한 추가
dhshin98 Dec 27, 2023
27f92ba
Merge pull request #8 from team-REDDI/feature/1-login-page
dhshin98 Dec 27, 2023
a92c7f5
fix: 함수 수정
leejin-rho Dec 27, 2023
658d686
feat: 파트장 투표 api
dhshin98 Dec 27, 2023
3a6e426
feat: teamvote 구현
leejin-rho Dec 27, 2023
fb377be
fix: 숫자값 id->index값으로변경
leejin-rho Dec 27, 2023
dfdb600
Merge pull request #9 from team-REDDI/feature/6-vote-api-2
leejin-rho Dec 27, 2023
d016337
chore: alert 추가
leejin-rho Dec 27, 2023
b22d3b6
Merge pull request #10 from team-REDDI/feature/6-vote-api-2
leejin-rho Dec 27, 2023
6b9536b
fix: key값 추가
leejin-rho Dec 27, 2023
ce621ab
fix: key값 추가
leejin-rho Dec 27, 2023
d0a2c60
feat: 본인이 속한 팀 투표 불가능
dhshin98 Dec 27, 2023
5471d5d
Merge pull request #11 from team-REDDI/feature/6-vote-api-2
dhshin98 Dec 27, 2023
5895390
fix: part component이름변경
leejin-rho Dec 27, 2023
83aaab2
style: 가장 표 많이 받은 결과 style변경
leejin-rho Dec 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_API_URL = 'http://3.34.190.160:8080/'
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"singleQuote": false,
"semi": true,
"useTabs": false,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 80
}

45 changes: 45 additions & 0 deletions api/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import client from "./client";

export const signIn = async (userData) => {
const response = await client.post("/api/auth/signin", {
username: userData.username,
password: userData.password,
});
return response.data;
};

export const loginUserInfo = async (info) => {
const response = await client.get("/api/member/info", {
headers: {
Authorization: `Bearer ${info.accessToken}`,
},
Comment on lines +13 to +15

Choose a reason for hiding this comment

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

accessToken을 사용하는 api가 많아지면 인스턴스화 할 때 헤더에 붙여줘도 좋을 것 같아요!

});
return response.data;
};

export const signUp = async (userData) => {
const response = await client.post("/api/auth/signup", {
username: userData.username,
password: userData.password,
name: userData.name,
email: userData.email,
teamName: userData.teamName,
part: userData.part,
isVerified: true,
});
return response.data;
};

export const checkUsername = async (username) => {
const response = await client.post("/api/auth/verify/username", {
username: username,
});
return response.data;
};

export const checkEmail = async (email) => {
const response = await client.post("/api/auth/verify/email", {
email: email,
});
return response.data;
};
8 changes: 8 additions & 0 deletions api/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from "axios";

const client = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_URL,

Choose a reason for hiding this comment

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

서버 url env로 빼두셨군요! 저희는 하드코딩으로 넣었는데 이렇게 env로 빼두면 나중에 수정하기 좋을 것 같네요~!

withCredentials: true,
});

export default client;
22 changes: 22 additions & 0 deletions api/getResult.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import client from "./client";

//프론트 투표 결과 get
export const getFrontResult = async () => {
const response = await client.get(`/api/partleader/front/result`);
// console.log(response.data);
return response.data.data;
};

//백 투표 결과 get
export const getBackResult = async () => {
const response = await client.get(`/api/partleader/back/result`);
// console.log(response.data);
return response.data.data;
};

//데모데이 투표 결과 get
export const getProjectResult = async () => {
const response = await client.get(`/api/project/result`);
// console.log(response.data);
return response.data.data;
};
Comment on lines +1 to +22
Copy link

Choose a reason for hiding this comment

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

같은 로직이여서 url을 외부에서 매개변수로 받아서 통일시켜주는 것도 좋을 것 같아요 ㅎㅎ

53 changes: 53 additions & 0 deletions api/voteAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import client from "./client";

//front 투표 리스트 get
export const getFrontList = async () => {
const response = await client.get(`/api/partleader/front`);
//console.log(response.data);
return response.data.data;
};

//back 투표 리스트 get
export const getBackList = async () => {
const response = await client.get(`/api/partleader/back`);
// console.log(response.data);
return response.data.data;
};

//team 투표 리스트 get
export const getTeamList = async () => {
const response = await client.get(`/api/project`);
// console.log(response.data);
return response.data.data;
};

//partleader 투표
export const voteLeader = async (info) => {
const response = await client.post(
`/api/partleader`,
{ partLeaderId: info.partLeaderId },
{
headers: {
Authorization: `Bearer ${info.accessToken}`,
},
},
);
console.log(response.data);
return response.data.data;
};

//partleader 투표
export const voteTeam = async (info) => {
const response = await client.post(
`/api/project`,
{ projectId: info.projectId },

{
headers: {
Authorization: `Bearer ${info.accessToken}`,
},
},
);
//console.log(response.data);
return response.data.data;
};
9 changes: 9 additions & 0 deletions components/HeadFunction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Head from "next/head";
//Head Title 바꾸는 컴포넌트
export default function HeadFunction({ title }) {
return (
<Head>
<title>{title} page | REDDI</title>
</Head>
);
}
58 changes: 58 additions & 0 deletions components/Layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import Image from "next/image";
import Link from "next/link";
import styles from "../styles/Home.module.css";
import { useState } from "react";
import { isLogin } from "../utils/atom";
import { useRecoilState } from "recoil";
import { useRouter } from "next/router";

export default function Layout({ children }) {
const router = useRouter();
const [isLoginState, setIsLoginState] = useRecoilState(isLogin);
return (
<>
<div className={styles.headBox}>
<Link href="/">
<a>
<Image
src="/images/ceosIcon.svg"
width={172}
height={73}
alt="Logo"
/>
</a>
</Link>

{isLoginState ? (
<div className={styles.loginBox}>
<button
className={`${styles.buttons} ${styles.loginButton}`}
onClick={() => {
alert("로그아웃 완료");
setIsLoginState(false);
router.push("/");
}}
>
로그아웃
</button>
</div>
) : (
<div className={styles.loginBox}>
<Link href="/login">
<button className={`${styles.buttons} ${styles.loginButton}`}>
로그인
</button>
</Link>
<Link href="/signup">
<button className={`${styles.buttons} ${styles.signupButton}`}>
회원가입
</button>
</Link>
</div>
)}
</div>

<div>{children}</div>
</>
);
}
7 changes: 7 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
}

module.exports = nextConfig
Loading