-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from KEEPER31337/feature/스터디_페이지_구현
Feature/스터디 페이지 구현
- Loading branch information
Showing
31 changed files
with
2,612 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import axios from 'axios'; | ||
|
||
const API_URL = process.env.REACT_APP_API_URL; | ||
|
||
async function getYears({ token }) { | ||
const options = { | ||
method: 'GET', | ||
url: API_URL + '/v1/study/years', | ||
headers: { | ||
Authorization: `${token}`, | ||
}, | ||
}; | ||
try { | ||
const response = await axios(options); | ||
return response.data; | ||
} catch (error) { | ||
return error.response.data; | ||
} | ||
} | ||
async function getStudies({ token, year, season }) { | ||
const options = { | ||
method: 'GET', | ||
url: API_URL + '/v1/study/list', | ||
headers: { | ||
Authorization: token, | ||
}, | ||
params: { year: year, season: season }, | ||
}; | ||
try { | ||
const response = await axios(options); | ||
return response.data; | ||
} catch (error) { | ||
return error.response.data; | ||
} | ||
} | ||
async function create({ | ||
year, | ||
season, | ||
title, | ||
information, | ||
memberIdList, | ||
gitLink, | ||
noteLink, | ||
etcLink, | ||
thumbnailFile, | ||
ipAddress, | ||
token, | ||
}) { | ||
const formData = new FormData(); | ||
formData.append('studyDto.title', title); | ||
formData.append('studyDto.information', information); | ||
formData.append('studyDto.year', year); | ||
formData.append('studyDto.season', season); | ||
formData.append('studyDto.ipAddress', ipAddress); | ||
//formData.append('memberIdList', headMember); | ||
formData.append('memberIdList[]', memberIdList); | ||
formData.append('studyDto.gitLink', gitLink); | ||
formData.append('studyDto.noteLink', noteLink); | ||
formData.append('studyDto.etcLink', etcLink); | ||
if (thumbnailFile) formData.append('thumbnail', thumbnailFile); | ||
|
||
const config = { | ||
headers: { | ||
'content-type': 'multipart/form-data', | ||
Authorization: `${token}`, | ||
}, | ||
}; | ||
try { | ||
const response = await axios.post(API_URL + '/v1/study', formData, config); | ||
return response.data; | ||
} catch (error) { | ||
return error.response.data; | ||
} | ||
} | ||
async function modify({ | ||
studyId, | ||
year, | ||
season, | ||
title, | ||
information, | ||
memberIdList, | ||
gitLink, | ||
noteLink, | ||
etcLink, | ||
thumbnailFile, | ||
ipAddress, | ||
token, | ||
}) { | ||
const formData = new FormData(); | ||
formData.append('studyId', studyId); | ||
formData.append('studyDto.title', title); | ||
formData.append('studyDto.information', information); | ||
formData.append('studyDto.year', year); | ||
formData.append('studyDto.season', season); | ||
formData.append('studyDto.ipAddress', ipAddress); | ||
//formData.append('memberIdList', headMember); | ||
formData.append('memberIdList[]', memberIdList); | ||
formData.append('studyDto.gitLink', gitLink); | ||
formData.append('studyDto.noteLink', noteLink); | ||
formData.append('studyDto.etcLink', etcLink); | ||
if (thumbnailFile) formData.append('thumbnail', thumbnailFile); | ||
|
||
const config = { | ||
headers: { | ||
'content-type': 'multipart/form-data', | ||
Authorization: `${token}`, | ||
}, | ||
}; | ||
try { | ||
const response = await axios.put(API_URL + '/v1/study', formData, config); | ||
return response.data; | ||
} catch (error) { | ||
return error.response.data; | ||
} | ||
} | ||
|
||
export default { | ||
getYears, | ||
getStudies, | ||
create, | ||
modify, | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.