✨ Make the prefetch supports typescript and opengraph.
⚡ Use prefetch in Solarpass pfp
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Solarpass</title>
|
||||
<app-data />
|
||||
<og-data />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
7
DysonNetwork.Pass/Client/src/dy-prefetch.d.ts
vendored
Normal file
7
DysonNetwork.Pass/Client/src/dy-prefetch.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export {}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
DyPrefetch?: any
|
||||
}
|
||||
}
|
@@ -46,8 +46,8 @@ import CaptchaWidget from '@/components/CaptchaWidget.vue';
|
||||
const route = useRoute();
|
||||
|
||||
// Get provider and API key from app data
|
||||
const provider = ref((window as any).__APP_DATA__?.Provider || '');
|
||||
const apiKey = ref((window as any).__APP_DATA__?.ApiKey || '');
|
||||
const provider = ref(window.DyPrefetch?.provider || '');
|
||||
const apiKey = ref(window.DyPrefetch?.api_key || '');
|
||||
|
||||
const onCaptchaVerified = (token: string) => {
|
||||
if (window.parent !== window) {
|
||||
|
@@ -116,8 +116,8 @@ const rules: FormRules = {
|
||||
}
|
||||
|
||||
// Get captcha provider and API key from global data
|
||||
const captchaProvider = ref((window as any).__APP_DATA__?.Provider || '')
|
||||
const captchaApiKey = ref((window as any).__APP_DATA__?.ApiKey || '')
|
||||
const captchaProvider = ref(window.DyPrefetch?.provider || '')
|
||||
const captchaApiKey = ref(window.DyPrefetch?.api_key || '')
|
||||
|
||||
const onCaptchaVerified = (token: string) => {
|
||||
formModel.captchaToken = token
|
||||
|
@@ -175,11 +175,9 @@ const notFound = ref<boolean>(false)
|
||||
const user = ref<any>(null)
|
||||
|
||||
async function fetchUser() {
|
||||
// @ts-ignore
|
||||
if (window.__APP_DATA__?.Account != null) {
|
||||
if (window.DyPrefetch?.Account != null) {
|
||||
console.log('[Fetch] Use the pre-rendered account data.')
|
||||
// @ts-ignore
|
||||
user.value = window.__APP_DATA__['Account']
|
||||
user.value = window.DyPrefetch.Account
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user