Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dcf7b4f
[Deploy] Run jar on EC2
Imggaggu May 11, 2025
e7a6649
[fix] React & Spring Boot 연결 시도_1
l-wanderer01 May 11, 2025
acba3a6
Merge pull request #66 from pirogramming/main
qkrxogmla May 11, 2025
38abc48
Merge pull request #68 from pirogramming/frontend
NamKyeongMin May 11, 2025
ad78ca4
전역에서 세션만료시 로그인페이지로 api
qkrxogmla May 11, 2025
c396c58
Merge pull request #69 from pirogramming/frontend_th
qkrxogmla May 11, 2025
e112d19
fetch 절대경로 수정
qkrxogmla May 11, 2025
7611e8c
Merge pull request #70 from pirogramming/frontend
qkrxogmla May 11, 2025
bbae9a3
Merge pull request #71 from pirogramming/frontend_th
qkrxogmla May 11, 2025
70c865e
fetch usesr 수정
qkrxogmla May 11, 2025
1130607
Merge pull request #72 from pirogramming/frontend_th
qkrxogmla May 11, 2025
5c15ca1
세션만료시 로그인페이지
qkrxogmla May 11, 2025
64bad80
base url http://www.pirocheck.org/api
qkrxogmla May 11, 2025
e79f482
Merge pull request #73 from pirogramming/frontend_th
qkrxogmla May 11, 2025
c94f385
attendance api수정
qkrxogmla May 11, 2025
8b8c1f7
Merge pull request #74 from pirogramming/frontend_th
qkrxogmla May 11, 2025
55f7d52
Update deploy.yml
Imggaggu May 12, 2025
c15dd04
Update deploy.yml
Imggaggu May 12, 2025
3aa2521
Update deploy.yml
Imggaggu May 12, 2025
7c562d9
[Fix] baseurl for api
Imggaggu May 12, 2025
b633405
Merge branch 'main' into frontend_sj
Imggaggu May 12, 2025
e31d056
Merge pull request #75 from pirogramming/frontend_sj
Imggaggu May 12, 2025
0a1150b
Merge pull request #76 from pirogramming/main
Imggaggu May 12, 2025
ec1224c
[Fix]back-allowed origins url
Imggaggu May 12, 2025
c5886d7
[Fix] baseurl for api
Imggaggu May 12, 2025
a2b27cb
[Chore] Generation/ admin directory 분리
Imggaggu May 12, 2025
5ecc609
[Chore] Generation/ admin directory 분리
Imggaggu May 12, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- name: Copy JAR to EC2
run: |
scp -o StrictHostKeyChecking=no -i pirocheck.pem backend/pirocheck/build/libs/*.jar ubuntu@${{ secrets.EC2_HOST }}:/home/ubuntu/


- name: Restart Spring Boot on EC2
run: |
Expand Down Expand Up @@ -106,4 +107,4 @@ jobs:
AWS_S3_BUCKET: www.pirocheck.org
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: frontend/dist
SOURCE_DIR: frontend/dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**") // 백엔드 API 요청에만 CORS 허용
.allowedOrigins("http://pirocheck.org:3000") // 프론트 배포 URL
.allowedOrigins("http://pirocheck.org") // 프론트 배포 URL
.allowedMethods("GET", "POST", "PUT", "DELETE") // 허용할 HTTP 메서드
.allowCredentials(true); // 세션 쿠키 주고받기 허용
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Login from "./Login";
import Home from "./Home";
import Assignment from "./Assignment";
import Deposit from "./Deposit";
import Assignment from "./pages/generation/Assignment";
import Deposit from "./pages/generation/Deposit";
import Intro from "./Intro";
import Admin from "./Admin";
import Attendance from "./Attendance";
import Admin from "./pages/admin/Admin";
import Attendance from "./pages/generation/Attendance";

function App() {
return (
Expand Down
19 changes: 19 additions & 0 deletions frontend/src/api/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import axios from "axios";

const api = axios.create({
baseURL: "http://api.pirocheck.org:8080/api",
withCredentials: true,
});

// 401 오류 시 로그인 페이지로 리다이렉트
api.interceptors.response.use(
(response) => response,
(error) => {
if (error.response?.status === 401) {
window.location.href = "/login";
}
return Promise.reject(error);
}
);

export default api;
6 changes: 2 additions & 4 deletions frontend/src/api/assignment.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import axios from "axios";
import api from "./api";

export const fetchAssignmentsByUser = async (userId) => {
const res = await axios.get(`/api/assignment/grouped/${userId}`, {
withCredentials: true
});
const res = await api.get(`/assignment/grouped/${userId}`);
return res.data;
};
2 changes: 1 addition & 1 deletion frontend/src/api/user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const loginUser = async ({ name, password }) => {
const res = await fetch("/api/login", {
const res = await fetch("http://api.pirocheck.org:8080/api/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useEffect, useState } from "react";
import WeeklyListBlock from "./components/WeeklyListBlock";
import Header from "./components/Header";
import AssignmentInfoBlock from "./components/AssignmentInfoBlock";
import WeeklyListBlock from "../../components/WeeklyListBlock";
import Header from "../../components/Header";
import AssignmentInfoBlock from "../../components/AssignmentInfoBlock";
import styles from "./Assignment.module.css";
import { mapStatus } from "./utils/AssignmentStatus.js";
import { mapStatus } from "../../utils/AssignmentStatus.js";
import { fetchAssignmentsByUser } from "../../api/assignment.js";

const Assignment = () => {
const [weeks, setWeeks] = useState([]);
Expand All @@ -16,18 +17,18 @@ const Assignment = () => {
if (!userId) return;

fetchAssignmentsByUser(userId)
.then((weekData) => {
const formatted = weekData.map((weekItem) => ({
label: `${weekItem.week}주차 ${weekItem.title}`,
details: weekItem.days.map((dayItem) => ({
day: dayItem.day,
subject: weekItem.title,
tasks: dayItem.details.map((task) => ({
label: task.assignmentName,
status: mapStatus(task.status),
.then((weekData) => {
const formatted = weekData.map((weekItem) => ({
label: `${weekItem.week}주차 ${weekItem.title}`,
details: weekItem.days.map((dayItem) => ({
day: dayItem.day,
subject: weekItem.title,
tasks: dayItem.details.map((task) => ({
label: task.assignmentName,
status: mapStatus(task.status),
})),
})),
})),
}));
}));

setWeeks(formatted);

Expand Down Expand Up @@ -63,4 +64,3 @@ const Assignment = () => {
};

export default Assignment;

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useState } from "react";
import Header from "./components/Header";
import InputBlock from "./components/InputBlock";
import AttendanceWeekInfo from "./components/AttendanceWeekInfo";
import Header from "../../components/Header";
import InputBlock from "../../components/InputBlock";
import AttendanceWeekInfo from "../../components/AttendanceWeekInfo";
import styles from "./Attendance.module.css";
import axios from "axios";
import api from "../../api/api";

const Attendance = () => {
const [attendanceCode, setAttendanceCode] = useState([""]);
Expand Down Expand Up @@ -88,7 +88,7 @@ const Attendance = () => {
if (!userId) return;

// 유저 전체 출석 데이터 불러오기
const res = await axios.get(`/api/attendance/user`, {
const res = await api.get(`/attendance/user`, {
params: { userId },
withCredentials: true, // 세션 기반 인증 요청처리
});
Expand All @@ -108,7 +108,7 @@ const Attendance = () => {
if (!userId) return;

const today = new Date().toISOString().split("T")[0]; // YYYY-MM-DD
const res = await axios.get(`/api/attendance/user/date`, {
const res = await api.get(`/attendance/user/date`, {
params: { userId, date: today },
withCredentials: true, // 세션 기반 인증 요청처리
});
Expand Down Expand Up @@ -151,8 +151,10 @@ const Attendance = () => {
if (!userId) return;

// 유저가 입력한 출석 코드 서버에 전달(서버에서 출석코드 체크)

const res = await axios.post(
"/api/attendance/mark",

{
userId,
code: attendanceCode[0],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Header from "./components/Header";
import Header from "../../components/Header";
import styles from "./Deposit.module.css";
import axios from "axios";
import { useEffect, useState } from "react";
import api from "../../api/api";

const Deposit = () => {
const [deposit, setDeposit] = useState(null);
Expand All @@ -12,10 +13,8 @@ const Deposit = () => {

if (!userId) return;

axios
.get(`/api/deposit/${userId}`, {
withCredentials: true, // 세션 쿠키 포함
})
api
.get(`/deposit/${userId}`)
.then((res) => setDeposit(res.data))
.catch((err) => {
alert("보증금 정보를 불러오지 못했습니다.");
Expand Down