fix redirect error
This commit is contained in:
@@ -1,59 +1,63 @@
|
||||
<template>
|
||||
<div class="preview-redirect">
|
||||
<h1>Preview Handler</h1>
|
||||
|
||||
<div v-if="error" class="error">
|
||||
<h2>Debug Information</h2>
|
||||
<p><strong>Error:</strong> {{ error }}</p>
|
||||
<p v-if="pageContext"><strong>PageContext keys:</strong> {{ pageContext.join(', ') }}</p>
|
||||
<pre v-if="urlParsed">{{ JSON.stringify(urlParsed, null, 2) }}</pre>
|
||||
<div class="preview-redirect">
|
||||
<h1>Preview Handler</h1>
|
||||
|
||||
<div v-if="error" class="error">
|
||||
<h2>Debug Information</h2>
|
||||
<p><strong>Error:</strong> {{ error }}</p>
|
||||
<p v-if="pageContext">
|
||||
<strong>PageContext keys:</strong> {{ pageContext.join(', ') }}
|
||||
</p>
|
||||
<pre v-if="urlParsed">{{ JSON.stringify(urlParsed, null, 2) }}</pre>
|
||||
</div>
|
||||
|
||||
<div v-else-if="redirectUrl">
|
||||
<p>Redirecting to preview...</p>
|
||||
<p>
|
||||
If you are not redirected automatically,
|
||||
<a :href="redirectUrl">click here</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<p>Processing preview request...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="redirectUrl">
|
||||
<p>Redirecting to preview...</p>
|
||||
<p>If you are not redirected automatically, <a :href="redirectUrl">click here</a>.</p>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<p>Processing preview request...</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useData } from 'vike-vue/useData'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
const data = useData()
|
||||
const { redirectUrl, error, pageContext, urlParsed } = data
|
||||
const { redirectUrl, error, pageContext, urlParsed } = useData()
|
||||
|
||||
onMounted(() => {
|
||||
if (redirectUrl) {
|
||||
window.location.href = redirectUrl
|
||||
}
|
||||
if (redirectUrl) {
|
||||
window.location.href = redirectUrl
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.preview-redirect {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 50vh;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 50vh;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user