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

syn #197

Merged
merged 21 commits into from
Jun 23, 2024
Merged

syn #197

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9629842
feat: FriendController에 친구신청수락 메서드 추가
minahYu Jun 18, 2024
9ed65cb
feat: Friend에 updateRequestStatus 메서드 추가
minahYu Jun 18, 2024
e5dc633
feat: FriendRepository 에 findByUserIdAndFriendIdAndRequestStatus 메서드 추가
minahYu Jun 18, 2024
173c667
feat: UserErrorCode 에 FRIENDSHIP_ALREADY_EXISTS_OR_NOT_FOUND 추가
minahYu Jun 18, 2024
a19b81b
feat: FriendService 에 acceptFriendRequest 메서드 추가
minahYu Jun 18, 2024
36c8fff
test: 친구신청 수락 controller 테스트코드 작성
minahYu Jun 18, 2024
7095dc6
test: 친구신청 수락 service 테스트코드 작성
minahYu Jun 18, 2024
2341ca4
[feat] 로그인 페이지 API연동
allone9425 Jun 19, 2024
2932923
[update] 회원가입 페이지 API 주소 변경
allone9425 Jun 19, 2024
a0666fe
chore: FriendService 에 주석 추가
minahYu Jun 19, 2024
f061784
refac: findByUserIdAndFriendIdAndRequestStatus 메서드 리턴타입 Optional<Frie…
minahYu Jun 19, 2024
ced3a9b
Merge branch 'dev' into feat/accept-friend-request
minahYu Jun 19, 2024
668d7b5
Merge pull request #186 from minahYu/feat/accept-friend-request
minahYu Jun 19, 2024
4a7121f
Merge pull request #192 from allone9425/feat/auth
allone9425 Jun 21, 2024
8b1d753
chore : move infra to other repo
yudonggeun Jun 23, 2024
fd4cb4f
chore : auth 이미지 registry 주소 변경 및 jib, openapi3 의존성 제거
yudonggeun Jun 23, 2024
49236c0
chore : server 이미지 registry 주소 변경 및 jib, openapi3 의존성 제거
yudonggeun Jun 23, 2024
63b2572
chore : user 이미지 registry 주소 변경 및 jib, openapi3 의존성 제거
yudonggeun Jun 23, 2024
d9f695f
chore : ci 스크립트 수정
yudonggeun Jun 23, 2024
6a557ed
Merge pull request #196 from yudonggeun/chore/cicd
yudonggeun Jun 23, 2024
3699191
Merge branch 'main' into dev
yudonggeun Jun 23, 2024
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
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Gradle jib를 통한 이미지 배포
- name: update image using jib
- name: make api documents
run: ./gradlew --info openapi3

- name: push image using jib
run: ./gradlew --info jib

tagging:
Expand Down
4 changes: 1 addition & 3 deletions auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,11 @@ jib {
}
}
to {
image = "youdong98/kpring-auth-application"
image = "kpring/auth-application"
setAllowInsecureRegistries(true)
tags = setOf("latest", version.toString())
}
container {
jvmFlags = listOf("-Xms512m", "-Xmx512m")
}
}

tasks.getByName("jib").dependsOn("openapi3")
2 changes: 1 addition & 1 deletion front/src/components/Auth/JoinBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function JoinBox() {
const submitJoin = async () => {
try {
const response = await axios.post(
"http://localhost:30002/api/v1/user",
"http://kpring.duckdns.org/user/api/v1/user",
{
email: values.email,
password: values.password,
Expand Down
73 changes: 48 additions & 25 deletions front/src/components/Auth/LoginBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@ import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import { useNavigate } from "react-router";
import { LoginValidation } from "../../hooks/LoginValidation";
import { useLoginStore } from "../../store/useLoginStore";

async function login(email: string, password: string) {
try {
const response = await fetch(
"http://kpring.duckdns.org/user/api/v1/login",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ email, password }),
}
);

const data = await response.json();
if (response.ok) {
console.log("로그인 성공:", data);
return data.data;
} else {
console.error("로그인 실패:", data);
return null;
}
} catch (error) {
console.error("API 호출 중 오류 발생:", error);
return null;
}
}

function LoginBox() {
const {
values,
Expand All @@ -15,6 +44,7 @@ function LoginBox() {
validatePassword,
validators,
} = LoginValidation();
const { setTokens } = useLoginStore();
const onChangeHandler = (
field: string,
event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
Expand All @@ -25,30 +55,20 @@ function LoginBox() {
setErrors((prevErrors) => ({ ...prevErrors, [`${field}Error`]: error }));
};

const clickSubmitHandler = (e: React.FormEvent) => {
const clickSubmitHandler = async (e: React.FormEvent) => {
e.preventDefault();

const emailError = validateEmail(values.email);
const passwordError = validatePassword(values.password);

setErrors({
emailError,
passwordError,
});

// setState가 비동기적으로 업데이트되어서 업데이트 완료 후 검사하도록 처리
setTimeout(() => {
// 유효성 검사를 해서 모든 에러가 없을때만 실행이 되고 alert를 통해 사용자에게 성공 메세지를 보여줌
if (!emailError && !passwordError) {
alert("로그인 성공!");
setValues({
email: "",
password: "",
});
}
}, 0);
//console.log("폼 제출 시도:", values);
const result = await login(values.email, values.password);
if (result) {
//console.log("토큰 설정:", result);
setTokens(result.accessToken, result.refreshToken);
//navigate("/");
} else {
console.error("로그인 실패.");
alert("로그인 실패. 이메일 혹은 비밀번호를 확인해 주세요.");
}
};
const navigation = useNavigate();
const navigate = useNavigate();
return (
<section className="flex justify-center mt-[200px]">
<div className="mt-[30px] w-[400px] text-center">
Expand All @@ -63,7 +83,8 @@ function LoginBox() {
"
border="1px solid #e4d4e7"
padding="20px"
onSubmit={clickSubmitHandler}>
onSubmit={clickSubmitHandler}
>
<h2 className="text-center text-2xl font-bold text-primary mt-[5px] mb-[10px]">
디코타운에 어서오세요!
</h2>
Expand Down Expand Up @@ -99,7 +120,8 @@ function LoginBox() {
type="submit"
variant="contained"
startIcon={<LoginIcon />}
sx={{ width: "90%" }}>
sx={{ width: "90%" }}
>
로그인
</Button>

Expand All @@ -108,7 +130,8 @@ function LoginBox() {
color="secondary"
startIcon={<PersonAddAlt1Icon />}
sx={{ mt: "20px", width: "90%", mb: "20px" }}
onClick={() => navigation("/join")}>
onClick={() => navigate("/join")}
>
회원가입
</Button>
</div>
Expand Down
17 changes: 17 additions & 0 deletions front/src/store/useLoginStore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import create from "zustand";

interface LoginState {
accessToken: string;
refreshToken: string;
setTokens: (accessToken: string, refreshToken: string) => void;
}

export const useLoginStore = create<LoginState>((set) => ({
accessToken: "",
refreshToken: "",
setTokens: (accessToken, refreshToken) => {
set({ accessToken, refreshToken });
localStorage.setItem("dicoTown_AccessToken", accessToken);
localStorage.setItem("dicoTown_RefreshToken", refreshToken);
},
}));
23 changes: 0 additions & 23 deletions infra/.helmignore

This file was deleted.

12 changes: 0 additions & 12 deletions infra/Chart.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions infra/charts/auth/.helmignore

This file was deleted.

8 changes: 0 additions & 8 deletions infra/charts/auth/Chart.yaml

This file was deleted.

62 changes: 0 additions & 62 deletions infra/charts/auth/templates/_helpers.tpl

This file was deleted.

12 changes: 0 additions & 12 deletions infra/charts/auth/templates/configmap.yaml

This file was deleted.

44 changes: 0 additions & 44 deletions infra/charts/auth/templates/deployment.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions infra/charts/auth/templates/redis-deployment.yaml

This file was deleted.

Loading