elk/pages/[...permalink].vue
2022-12-04 19:56:33 +00:00

27 lines
542 B
Vue

<script setup lang="ts">
import { hasProtocol, parseURL } from 'ufo'
definePageMeta({
middleware: async (to) => {
const permalink = Array.isArray(to.params.permalink)
? to.params.permalink.join('/')
: to.params.permalink
if (hasProtocol(permalink)) {
const { host, pathname } = parseURL(permalink)
if (host) {
await loginTo({ server: host })
return pathname
}
}
// We've reached a page that doesn't exist
return false
},
})
</script>
<template>
<div />
</template>