Skip to content

Commit

Permalink
fix: when using the basic_captacha plug-in, usePromptWithUnload hook …
Browse files Browse the repository at this point in the history
…causes logic exceptions when asking or editing questions
  • Loading branch information
shuashuai committed May 9, 2024
1 parent 219dc7f commit 58970d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions ui/src/pages/Questions/Ask/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ const Ask = () => {
};

const submitModifyQuestion = (params) => {
setBlockState(false);
const ep = {
...params,
id: qid,
Expand Down Expand Up @@ -312,6 +313,7 @@ const Ask = () => {
};

const submitQuestion = async (params) => {
setBlockState(false);
const imgCode = saveCaptcha?.getCaptcha();
if (imgCode?.verify) {
params.captcha_code = imgCode.captcha_code;
Expand Down Expand Up @@ -371,16 +373,12 @@ const Ask = () => {

if (isEdit) {
if (!editCaptcha) {
setBlockState(false);
submitModifyQuestion(params);
return;
}
editCaptcha.check(() => {
submitModifyQuestion(params);
});
editCaptcha.check(() => submitModifyQuestion(params));
} else {
if (!saveCaptcha) {
setBlockState(false);
submitQuestion(params);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Questions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Questions: FC = () => {
Storage.set(QUESTIONS_ORDER_STORAGE_KEY, curOrder);
}
const reqParams: Type.QueryQuestionsReq = {
page_size: 10,
page_size: 20,
page: curPage,
order: curOrder as Type.QuestionOrderBy,
};
Expand Down

0 comments on commit 58970d0

Please sign in to comment.