Skip to content

Commit

Permalink
Q&A page submit button error and responsiveness corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
SwayamRana808 committed May 16, 2024
1 parent 0d45f00 commit 614f9be
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
25 changes: 17 additions & 8 deletions frontend/src/pages/Q&A/Q&A.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function Ques(props) {
const handleCloseToast = (event, reason) => {
setTimeout(() => {
setOpenToast(false);
}, 500);
}, 1000);
};
const handleOnChange = (position) => {
const updatedCheckedState = checkedState.map((item, index) =>
Expand Down Expand Up @@ -124,10 +124,19 @@ function Ques(props) {
body: JSON.stringify(formdata),
});
const data = await response.json();

setIsUploadingData(false);
setToastMessage("Q&A added successfully!");
setOpenToast(true);
setSeverity("success");
console.log(data)
if(!data.errorType){
setToastMessage("Q&A added successfully!");
setOpenToast(true);
setSeverity("success");

}else{
setToastMessage(`${data.errStack}`);
setOpenToast(true);
setSeverity("error");
}
setFormData({
title: "",
description: "",
Expand Down Expand Up @@ -421,14 +430,14 @@ function Ques(props) {
style={{ justifyContent: "space-around" }}
>
<div className="data-loader">
{isUploadingData ? <Loader /> : null}
</div>
<Button2
{isUploadingData ? <Loader /> : <Button2
style={{ marginRight: "3%" }}
className={style["submit-btn-text"]}
label="Submit"
type="submit"
/>
/>}
</div>

</div>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Q&A/Ques.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
.data-loader {
width: 100%;
display: flex;
height: 10px;
height: 60px;
justify-content: center;
align-items: center;
}

0 comments on commit 614f9be

Please sign in to comment.