File tree Expand file tree Collapse file tree 9 files changed +23
-19
lines changed
Expand file tree Collapse file tree 9 files changed +23
-19
lines changed Original file line number Diff line number Diff line change 11import type { Comment } from '@/pages/admin/ApplicationDetail/types/comments' ;
22
33export const fetchComments = async ( applicationId : number ) : Promise < Comment [ ] > => {
4- const url = `/api /applications/${ applicationId } /comments` ;
4+ const url = `${ import . meta . env . VITE_API_BASE_URL } /applications/${ applicationId } /comments` ;
55 const response = await fetch ( url ) ;
66
77 if ( ! response . ok ) throw new Error ( 'Failed to fetch comments' ) ;
@@ -13,7 +13,8 @@ export const createComment = async (
1313 content : string ,
1414 rating : number ,
1515) : Promise < Comment > => {
16- const url = `/api/applications/${ applicationId } /comments` ;
16+ const url = `${ import . meta. env . VITE_API_BASE_URL } /applications/${ applicationId } /comments` ;
17+
1718 const response = await fetch ( url , {
1819 method : 'POST' ,
1920 headers : {
@@ -27,7 +28,7 @@ export const createComment = async (
2728} ;
2829
2930export const deleteComment = async ( applicationId : number , commentId : number ) : Promise < void > => {
30- const url = `/api /applications/${ applicationId } /comments/${ commentId } ` ;
31+ const url = `${ import . meta . env . VITE_API_BASE_URL } /applications/${ applicationId } /comments/${ commentId } ` ;
3132 const response = await fetch ( url , {
3233 method : 'DELETE' ,
3334 } ) ;
@@ -41,7 +42,7 @@ export const updateComment = async (
4142 content : string ,
4243 rating : number ,
4344) : Promise < Comment > => {
44- const url = `/api /applications/${ applicationId } /comments/${ commentId } ` ;
45+ const url = `${ import . meta . env . VITE_API_BASE_URL } /applications/${ applicationId } /comments/${ commentId } ` ;
4546 const response = await fetch ( url , {
4647 method : 'PATCH' ,
4748 headers : {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export const fetchDetailApplication = async (
44 clubId : number ,
55 applicantId : number ,
66) : Promise < DetailApplication > => {
7- const url = `/api /clubs/${ clubId } /applicants/${ applicantId } /application` ;
7+ const url = `${ import . meta . env . VITE_API_BASE_URL } /clubs/${ clubId } /applicants/${ applicantId } /application` ;
88 const response = await fetch ( url ) ;
99
1010 if ( ! response . ok ) throw new Error ( '지원서 상세 정보를 가져오지 못했습니다' ) ;
@@ -15,7 +15,7 @@ export const updateApplicationStatus = async (
1515 applicationId : number ,
1616 status : DetailApplication [ 'status' ] ,
1717) : Promise < unknown > => {
18- const url = `/api /applications/${ applicationId } ` ;
18+ const url = `${ import . meta . env . VITE_API_BASE_URL } /applications/${ applicationId } ` ;
1919 const response = await fetch ( url , {
2020 method : 'PATCH' ,
2121 headers : {
Original file line number Diff line number Diff line change 11import type { ClubDetailEdit } from '../types/clubDetailEdit' ;
22
33export const fetchClubDetailEdit = async ( clubId : string | number ) : Promise < ClubDetailEdit > => {
4- const url = `/api /clubs/${ clubId } ` ;
4+ const url = `${ import . meta . env . VITE_API_BASE_URL } /clubs/${ clubId } ` ;
55 const response = await fetch ( url ) ;
66
77 if ( ! response . ok ) {
88 throw new Error ( '동아리 상세 수정 데이터를 가져오는데 실패했습니다.' ) ;
99 }
1010 return response . json ( ) as Promise < ClubDetailEdit > ;
1111} ;
12+
1213export const updateClubDetailEdit = async (
1314 clubId : string | number ,
1415 updatedData : Partial < ClubDetailEdit > ,
1516) : Promise < ClubDetailEdit > => {
16- const url = `/api /clubs/${ clubId } ` ;
17+ const url = `${ import . meta . env . VITE_API_BASE_URL } /clubs/${ clubId } ` ;
1718 const response = await fetch ( url , {
1819 method : 'POST' ,
1920 headers : {
Original file line number Diff line number Diff line change 11import type { ApplicantData } from '@/pages/admin/Dashboard/types/dashboard' ;
22
33export const fetchApplicants = async ( clubId : number ) : Promise < ApplicantData [ ] > => {
4- const url = `/api /clubs/${ clubId } /dashboard/applicants` ;
4+ const url = `${ import . meta . env . VITE_API_BASE_URL } /clubs/${ clubId } /dashboard/applicants` ;
55 const response = await fetch ( url ) ;
66
77 if ( ! response . ok ) {
Original file line number Diff line number Diff line change 11import type { DashboardSummary } from '@/pages/admin/Dashboard/types/dashboard' ;
22
33export const fetchDashboardSummary = async ( clubId : number ) : Promise < DashboardSummary > => {
4- const response = await fetch ( `/api/clubs/${ clubId } /dashboard` ) ;
4+ const url = `${ import . meta. env . VITE_API_BASE_URL } /clubs/${ clubId } /dashboard` ;
5+ const response = await fetch ( url ) ;
56
67 if ( ! response . ok ) {
78 throw new Error ( '대시보드 요약 정보를 불러오는 데 실패했습니다.' ) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type {
66} from '@/pages/user/Apply/type/apply.ts' ;
77
88export const fetchApplicationForm = async ( Id : number ) : Promise < ApplicationForm > => {
9- const url = `/api /clubs/${ Id } /apply` ;
9+ const url = `${ import . meta . env . VITE_API_BASE_URL } /clubs/${ Id } /apply` ;
1010 const response = await fetch ( url ) ;
1111
1212 if ( ! response . ok ) throw new Error ( '지원서 양식을 가져오지 못했습니다' ) ;
@@ -20,7 +20,7 @@ export const postApplicationForm = async (
2020) : Promise < ApplicationFormRequest > => {
2121 const applicationDto = applicationFormDto ( formData , questionArray ) ;
2222
23- const url = `/api /clubs/${ clubId } /apply-submit` ;
23+ const url = `${ import . meta . env . VITE_API_BASE_URL } /clubs/${ clubId } /apply-submit` ;
2424 const response = await fetch ( url , {
2525 method : 'POST' ,
2626 headers : {
Original file line number Diff line number Diff line change 11import type { ClubDetail } from '../types/clubDetail' ;
22
33export const fetchClubDetail = async ( clubId : number ) : Promise < ClubDetail > => {
4- const url = `/api /clubs/${ clubId } ` ;
5- const res = await fetch ( url ) ;
4+ const url = `${ import . meta . env . VITE_API_BASE_URL } /clubs/${ clubId } ` ;
5+ const response = await fetch ( url ) ;
66
7- if ( ! res . ok ) {
7+ if ( ! response . ok ) {
88 throw new Error ( '동아리 상세 정보를 가져오는데 실패했습니다.' ) ;
99 }
10-
11- return res . json ( ) as Promise < ClubDetail > ;
10+ return response . json ( ) as Promise < ClubDetail > ;
1211} ;
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ export type ClubResponse = {
66} ;
77
88export async function getClubsByCategory ( filter : ClubCategoryEng ) : Promise < ClubResponse > {
9- const response = await fetch ( import . meta. env . VITE_API_BASE_URL + `/clubs?category=${ filter } ` ) ;
9+ const url = `${ import . meta. env . VITE_API_BASE_URL } /clubs?category=${ filter } ` ;
10+ const response = await fetch ( url ) ;
11+
1012 return await response . json ( ) ;
1113}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export default ({ mode }: ConfigEnv) => {
2020 server : {
2121 proxy : {
2222 '/api' : {
23- target : env . VITE_API_BASE_URL ,
23+ target : env . VITE_PROXY_TARGET ,
2424 changeOrigin : true ,
2525 secure : false ,
2626 } ,
You can’t perform that action at this time.
0 commit comments