From b75309f4afd951db85726d838a511a4984a90b27 Mon Sep 17 00:00:00 2001 From: Mateusz Tylka Date: Fri, 19 May 2023 10:38:18 +0200 Subject: [PATCH] submit tags request --- .env | 4 +++- src/api/challengeSubmissionPost.js | 6 ++++-- src/pages/Submit/Submit.js | 4 ++-- src/pages/Submit/components/SubmissionLoading/index.js | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 9a7fd9a..540f4b6 100644 --- a/.env +++ b/.env @@ -2,4 +2,6 @@ REACT_APP_KC_URL=https://auth-dev.csi.wmi.amu.edu.pl/ REACT_APP_KC_REALM=gonito-dev REACT_APP_KC_CLIENT_ID=gonito-dev-localhost -REACT_APP_API=https://gonito-back-dev.csi.wmi.amu.edu.pl/api \ No newline at end of file +REACT_APP_API=https://gonito-back-dev.csi.wmi.amu.edu.pl/api +# https://gonito.net/api +# https://gonito-back-dev.csi.wmi.amu.edu.pl/api \ No newline at end of file diff --git a/src/api/challengeSubmissionPost.js b/src/api/challengeSubmissionPost.js index 7f7fe6f..d5ae8f7 100644 --- a/src/api/challengeSubmissionPost.js +++ b/src/api/challengeSubmissionPost.js @@ -10,9 +10,10 @@ const challengeSubmission = ( submissionTags, dispatch ) => { + const tagNames = submissionTags.map((tag) => tag.name).join(','); const details = { f1: description, - f2: submissionTags, + f2: tagNames, f3: repoUrl, f4: repoBranch, }; @@ -20,6 +21,8 @@ const challengeSubmission = ( for (let property in details) { let encodedKey = encodeURIComponent(property); let encodedValue = encodeURIComponent(details[property]); + if (property === 'f2') + encodedValue = encodedValue.replaceAll('%2C', '%2C+'); formBody.push(encodedKey + '=' + encodedValue); } formBody = formBody.join('&'); @@ -33,7 +36,6 @@ const challengeSubmission = ( }) .then((resp) => resp.json()) .then((data) => { - console.log(data); dispatch({ type: SUBMIT_ACTION.TOGGLE_SUBMISSION_LOADING }); const processUrl = API.replace('/api', ''); window.location.replace(`${processUrl}/open-view-progress/${data}#form`); diff --git a/src/pages/Submit/Submit.js b/src/pages/Submit/Submit.js index de40630..14db465 100644 --- a/src/pages/Submit/Submit.js +++ b/src/pages/Submit/Submit.js @@ -11,7 +11,7 @@ import TagsChoose from './components/TagsChoose'; import SubmitReducer from './model/SubmitReducer'; import SUBMIT_ACTION from './model/SubmitActionEnum'; import SubmitStyle from './SubmitStyle'; -import SubmissionLoadingStyle from './components/SubmissionLoading/SubmissionLoadingStyle'; +import SubmissionLoading from './components/SubmissionLoading/SubmissionLoading'; const Submit = (props) => { const [state, dispatch] = React.useReducer(SubmitReducer, { @@ -93,7 +93,7 @@ const Submit = (props) => { ); } else { - return createPortal(, document.body); + return createPortal(, document.body); } }; diff --git a/src/pages/Submit/components/SubmissionLoading/index.js b/src/pages/Submit/components/SubmissionLoading/index.js index e69de29..ebd4a93 100644 --- a/src/pages/Submit/components/SubmissionLoading/index.js +++ b/src/pages/Submit/components/SubmissionLoading/index.js @@ -0,0 +1 @@ +export { default } from './SubmissionLoading';