You've already forked AstralRinth
forked from didirus/AstralRinth
Fix modrinth+ firing ad requests on load (#4792)
This commit is contained in:
@@ -387,7 +387,7 @@ async function fetchCredentials() {
|
|||||||
if (creds && creds.user_id) {
|
if (creds && creds.user_id) {
|
||||||
creds.user = await get_user(creds.user_id).catch(handleError)
|
creds.user = await get_user(creds.user_id).catch(handleError)
|
||||||
}
|
}
|
||||||
credentials.value = creds
|
credentials.value = creds ?? null
|
||||||
}
|
}
|
||||||
|
|
||||||
async function signIn() {
|
async function signIn() {
|
||||||
@@ -434,20 +434,18 @@ const forceSidebar = computed(
|
|||||||
() => route.path.startsWith('/browse') || route.path.startsWith('/project'),
|
() => route.path.startsWith('/browse') || route.path.startsWith('/project'),
|
||||||
)
|
)
|
||||||
const sidebarVisible = computed(() => sidebarToggled.value || forceSidebar.value)
|
const sidebarVisible = computed(() => sidebarToggled.value || forceSidebar.value)
|
||||||
const showAd = computed(() => !(!sidebarVisible.value || hasPlus.value))
|
const showAd = computed(
|
||||||
|
() => sidebarVisible.value && !hasPlus.value && credentials.value !== undefined,
|
||||||
watch(
|
|
||||||
showAd,
|
|
||||||
() => {
|
|
||||||
if (!showAd.value) {
|
|
||||||
hide_ads_window(true)
|
|
||||||
} else {
|
|
||||||
init_ads_window(true)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true },
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(showAd, () => {
|
||||||
|
if (!showAd.value) {
|
||||||
|
hide_ads_window(true)
|
||||||
|
} else {
|
||||||
|
init_ads_window(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
invoke('show_window')
|
invoke('show_window')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user