Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion back/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const app = express();
// credentials: true
// }));
app.use(cors({
origin: 'http://localhost:3000', // 프론트 주소
origin: 'https://star-client-brown.vercel.app', // 프론트 주소
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization'],
credentials: true
Expand Down
1 change: 1 addition & 0 deletions front/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
2 changes: 1 addition & 1 deletion front/src/api/axios.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const instance = axios.create({
baseURL: 'http://localhost:8080/api', // 변경 시 여기만 수정
baseURL: 'https://star-isih.onrender.com', // 변경 시 여기만 수정
withCredentials: true
});

Expand Down
10 changes: 5 additions & 5 deletions front/src/pages/HotspotPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ const HotspotPage = () => {
try {
let response;
if (category === 'Auditorium Size / Large Hall') {
response = await axios.get('http://localhost:8080/api/analytics/popular-buildings/by-large-group');
response = await axios.get('https://star-isih.onrender.com/api/analytics/popular-buildings/by-large-group');
} else if (category === 'Study Friendly') {
response = await axios.get('http://localhost:8080/api/analytics/popular-buildings/by-purpose?purpose=Study');
response = await axios.get('https://star-isih.onrender.com/api/analytics/popular-buildings/by-purpose?purpose=Study');
} else if (category === 'Meeting & Presentation / Collab Zones') {
response = await axios.get('http://localhost:8080/api/analytics/popular-buildings/by-purpose?purpose=Meeting');
response = await axios.get('https://star-isih.onrender.com/api/analytics/popular-buildings/by-purpose?purpose=Meeting');
}

const hotspotData = Array.isArray(response.data) ? response.data : [response.data];

const allBuildingsRes = await axios.get('http://localhost:8080/api/buildings');
const allBuildingsRes = await axios.get('https://star-isih.onrender.com/api/buildings');
const allBuildings = allBuildingsRes.data.buildings;

const matched = hotspotData.map((item, i) => {
Expand Down Expand Up @@ -87,7 +87,7 @@ const HotspotPage = () => {

const handleReserve = async (building) => {
try {
const res = await axios.get(`http://localhost:8080/api/buildings/rooms?buildingNo=${building.id}`);
const res = await axios.get(`https://star-isih.onrender.com/api/buildings/rooms?buildingNo=${building.id}`);
const availableRooms = res.data.rooms.map(room => ({
room: `Room ${room}`,
time: '8:00 - 17:50',
Expand Down
2 changes: 1 addition & 1 deletion front/src/pages/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const LoginPage = () => {

const handleLogin = async () => {
try {
const res = await axios.post('http://localhost:8080/api/users/login', form);
const res = await axios.post('https://star-isih.onrender.com/api/users/login', form);
localStorage.setItem('token', res.data.token);
localStorage.setItem('user', JSON.stringify(res.data.user));
navigate('/'); // ✅ 메인 페이지로 이동
Expand Down
6 changes: 3 additions & 3 deletions front/src/pages/MyReservationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const MyReservationPage = () => {
// 🧭 건물 리스트 받아오기
const fetchBuildings = async () => {
try {
const res = await axios.get('http://localhost:8080/api/buildings');
const res = await axios.get('https://star-isih.onrender.com/api/buildings');
setBuildings(res.data.buildings || []);
} catch (err) {
console.warn('⚠️ 건물 정보 fetch 실패, fallback mock 사용');
Expand All @@ -39,7 +39,7 @@ const MyReservationPage = () => {
const fetchReservations = async () => {
try {
const token = localStorage.getItem('token');
const res = await axios.get('http://localhost:8080/api/reservations/my', {
const res = await axios.get('https://star-isih.onrender.com/api/reservations/my', {
headers: { Authorization: `Bearer ${token}` }
});
setReservations(res.data);
Expand Down Expand Up @@ -85,7 +85,7 @@ const MyReservationPage = () => {
const confirmCancel = async () => {
try {
const token = localStorage.getItem('token');
await axios.delete(`http://localhost:8080/api/reservations/${selectedReservation._id}`, {
await axios.delete(`https://star-isih.onrender.com/api/reservations/${selectedReservation._id}`, {
headers: { Authorization: `Bearer ${token}` }
});
setReservations(reservations.filter(r => r._id !== selectedReservation._id));
Expand Down
14 changes: 7 additions & 7 deletions front/src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ const ProfilePage = () => {
const token = localStorage.getItem('token');
if (!token) throw new Error('No token');

const res = await axios.get('http://localhost:8080/api/users/me', {
const res = await axios.get('https://star-isih.onrender.com/api/users/me', {
headers: { Authorization: `Bearer ${token}` }
});

const userData = res.data.user;
setUser(userData);

// 서버에서 전체 건물 목록 받아오기
const buildingsRes = await axios.get('http://localhost:8080/api/buildings');
// 서버에서 전체 건물 목록 받아오기
const buildingsRes = await axios.get('hhttps://star-isih.onrender.com/api/buildings');
const buildingData = buildingsRes.data.buildings;

// building.name과 userData.favorites를 비교해 매칭
// building.name과 userData.favorites를 비교해 매칭
const matched = await Promise.all(
buildingData
.filter(b => userData.favorites.includes(b.buildingName))
.map(async (b) => {
const roomRes = await axios.get(`http://localhost:8080/api/buildings/rooms?buildingNo=${b.buildingNo}`);
const roomRes = await axios.get(`https://star-isih.onrender.com/api/buildings/rooms?buildingNo=${b.buildingNo}`);
const availableRooms = roomRes.data.rooms || [];

return {
Expand Down Expand Up @@ -123,13 +123,13 @@ const ProfilePage = () => {

if (token) {
if (isAlreadyFavorite) {
await axios.delete('http://localhost:8080/api/users/favorites', {
await axios.delete('https://star-isih.onrender.com/api/users/favorites', {
headers: { Authorization: `Bearer ${token}` },
data: { building: buildingName },
});
updatedFavorites = user.favorites.filter((n) => n !== buildingName);
} else {
await axios.post('http://localhost:8080/api/users/favorites', { building: buildingName }, {
await axios.post('https://star-isih.onrender.com/api/users/favorites', { building: buildingName }, {
headers: { Authorization: `Bearer ${token}` },
});
updatedFavorites = [...user.favorites, buildingName];
Expand Down
10 changes: 5 additions & 5 deletions front/src/pages/ReservePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const ReservePage = () => {
try {
const token = localStorage.getItem('token');
const [buildingsRes, userRes] = await Promise.all([
axios.get('http://localhost:8080/api/buildings'),
axios.get('http://localhost:8080/api/users/me', {
axios.get('https://star-isih.onrender.com/api/buildings'),
axios.get('https://star-isih.onrender.com/api/users/me', {
headers: { Authorization: `Bearer ${token}` }
}),
]);
Expand All @@ -65,7 +65,7 @@ const ReservePage = () => {

const buildingList = await Promise.all(
buildingData.map(async (b) => {
const roomRes = await axios.get(`http://localhost:8080/api/buildings/rooms?buildingNo=${b.buildingNo}`);
const roomRes = await axios.get(`https://star-isih.onrender.com/api/buildings/rooms?buildingNo=${b.buildingNo}`);
const availableRooms = roomRes.data.rooms || [];
return {
id: String(b.buildingNo),
Expand Down Expand Up @@ -99,15 +99,15 @@ const ReservePage = () => {

try {
if (isAlreadyFavorite) {
await axios.delete('http://localhost:8080/api/users/favorites', {
await axios.delete('https://star-isih.onrender.com/api/users/favorites', {
headers: { Authorization: `Bearer ${token}` },
data: { building: buildingName },
});
const updated = favoriteIds.filter(name => name !== buildingName);
setFavoriteIds(updated);
localStorage.setItem('favorites', JSON.stringify(updated));
} else {
await axios.post('http://localhost:8080/api/users/favorites', { building: buildingName }, {
await axios.post('https://star-isih.onrender.com/api/users/favorites', { building: buildingName }, {
headers: { Authorization: `Bearer ${token}` },
});
const updated = [...favoriteIds, buildingName];
Expand Down
4 changes: 2 additions & 2 deletions front/src/pages/RoomDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const RoomDetailPage = () => {

const fetchAvailability = async () => {
try {
const res = await axios.get('http://localhost:8080/api/timetable/availability', {
const res = await axios.get('https://star-isih.onrender.com/api/timetable/availability', {
params: { building, room, week: formatDate(startOfWeek) }
});
applyGridFromAvailability(res.data.availability);
Expand Down Expand Up @@ -149,7 +149,7 @@ const RoomDetailPage = () => {

try {
await axios.post(
'http://localhost:8080/api/reservations',
'https://star-isih.onrender.com/api/reservations',
{
building,
room,
Expand Down
2 changes: 1 addition & 1 deletion front/src/pages/SignupPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const SignupPage = () => {

const handleSignup = async () => {
try {
await axios.post('http://localhost:8080/api/users/register', form);
await axios.post('https://star-isih.onrender.com/api/users/register', form);
alert('회원가입 성공!');
window.location.href = '/login';
} catch (err) {
Expand Down