moved issubmiossionenabled check before opening the popup

This commit is contained in:
Miodec 2023-07-25 17:25:17 +02:00
parent ad357d3948
commit a828fcfb01
2 changed files with 22 additions and 16 deletions

View file

@ -319,10 +319,28 @@ $("#quoteSearchPopupWrapper").on("mousedown", (e) => {
}
});
$("#popups").on("click", "#quoteSearchPopup #gotoSubmitQuoteButton", () => {
hide();
QuoteSubmitPopup.show(true);
});
$("#popups").on(
"click",
"#quoteSearchPopup #gotoSubmitQuoteButton",
async () => {
Loader.show();
const isSubmissionEnabled = (await Ape.quotes.isSubmissionEnabled()).data
.isEnabled;
Loader.hide();
if (!isSubmissionEnabled) {
Notifications.add(
"Quote submission is disabled temporarily due to a large submission queue.",
0,
{
duration: 5,
}
);
return;
}
hide();
QuoteSubmitPopup.show(true);
}
);
$("#popups").on("click", "#quoteSearchPopup #goToApproveQuotes", () => {
hide();

View file

@ -49,18 +49,6 @@ async function submitQuote(): Promise<void> {
}
export async function show(noAnim = false): Promise<void> {
const isSubmissionEnabled = (await Ape.quotes.isSubmissionEnabled()).data
.isEnabled;
if (!isSubmissionEnabled) {
Notifications.add(
"Quote submission is disabled temporarily due to a large submission queue.",
0,
{
duration: 5,
}
);
return;
}
Skeleton.append(wrapperId);
if (!Misc.isPopupVisible(wrapperId)) {