optional chaining

This commit is contained in:
Miodec 2022-09-27 22:19:40 +02:00
parent 632d615e38
commit 595d24ec56

View file

@ -108,7 +108,7 @@ function buildQuoteSearchResult(
lengthDesc = "thicc";
}
const loggedOut = !Auth.currentUser;
const loggedOut = !Auth?.currentUser;
const isFav = !loggedOut && QuotesController.isQuoteFavorite(quote);
return `
@ -193,7 +193,7 @@ export async function show(clearText = true): Promise<void> {
const quoteSearchInputValue = $("#quoteSearchPopup input").val() as string;
if (!Auth.currentUser) {
if (!Auth?.currentUser) {
$("#quoteSearchPopup #gotoSubmitQuoteButton").addClass("hidden");
$("#quoteSearchPopup #toggleShowFavorites").addClass("hidden");
} else {
@ -385,7 +385,7 @@ $(document).on("click", "#quoteSearchPopup .textButton.favorite", async (e) => {
});
$(document).on("click", "#toggleShowFavorites", (e) => {
if (!Auth.currentUser) {
if (!Auth?.currentUser) {
// Notifications.add("You need to be logged in to use this feature!", 0);
return;
}