fix: show PageNotFound page if not fc site

This commit is contained in:
Shariq Ansari 2024-11-14 17:49:01 +05:30
parent d9e4e9ff9d
commit 37a5e0eddb
3 changed files with 27 additions and 4 deletions

View file

@ -1,18 +1,27 @@
<template>
<div class="flex h-screen w-screen">
<div v-if="isFCSite.data" class="flex h-screen w-screen">
<div class="h-full border-r bg-gray-50">
<AppSidebar />
</div>
<div class="flex-1 flex flex-col h-full overflow-auto px-28">
<router-view />
</div>
<Dialogs />
<Toasts />
</div>
<Dialogs />
<Toasts />
<PageNotFound v-else />
</template>
<script setup>
import PageNotFound from './pages/PageNotFound.vue'
import AppSidebar from '@/components/AppSidebar.vue'
import { Dialogs } from '@/dialogs.js'
import { Toasts } from 'frappe-ui'
import { Toasts, createResource } from 'frappe-ui'
const isFCSite = createResource({
url: 'frappe.integrations.frappe_providers.frappecloud_billing.is_fc_site',
cache: 'isFCSite',
auto: true,
transform: (data) => Boolean(data),
})
</script>

View file

@ -0,0 +1,10 @@
<template>
<div class="h-screen flex flex-col justify-center items-center text-gray-600">
<h4 class="text-3xl font-semibold border-b pb-4">
{{ 'Page not found' }}
</h4>
<div class="text-base mt-4">
<a href="/" class="hover:underline">{{ 'Back to Home' }}</a>
</div>
</div>
</template>

View file

@ -81,3 +81,7 @@ def api(method, data=None):
return request.json().get("message")
else:
frappe.throw(_("Failed while calling API {0}", method))
@frappe.whitelist()
def is_fc_site():
return frappe.conf.get("fc_communication_secret")