Skip to content

Commit

Permalink
Move creator properties before set
Browse files Browse the repository at this point in the history
  • Loading branch information
JiashuHarryHuang committed May 2, 2024
1 parent 3741930 commit 854afb9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions pages/event/[pid]/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ export default function SurveyCreatorWidget() {
})
.then(data => {
console.log(data);
creator.survey.title = 'Volunteer Application for ' + data.name;
setEvent(data);
})
.then(() => {
creator.survey.title = 'Volunteer Application for ' + event?.name;
})
.catch(err => {
console.error(err);
messageApi.open({
Expand All @@ -81,13 +79,12 @@ export default function SurveyCreatorWidget() {
.then(data => {
console.log(data);
// console.log(convertApplicationToSurveyQuestions(data));

// Set the survey questions after converting the application questions
setSurveyQuestions(convertApplicationToSurveyQuestions(data));
})
.then(() => {
// Display survey qeustions after state is set
creator.text = JSON.stringify(surveyQuestions);
const fetchedSurveyQuestions =
convertApplicationToSurveyQuestions(data);
creator.text = JSON.stringify(fetchedSurveyQuestions);
// Set the survey questions after converting the application questions
setSurveyQuestions(fetchedSurveyQuestions);
})
.catch(err => {
console.log(err);
Expand Down

0 comments on commit 854afb9

Please sign in to comment.