Hinzufügen von SsrSkip-Komponente in App.svelte
Some checks failed
deploy to production / deploy (push) Failing after 48s
Some checks failed
deploy to production / deploy (push) Failing after 48s
This commit is contained in:
parent
2054870366
commit
de1aaadc46
@ -12,6 +12,7 @@
|
||||
import { loadContentAndSetStores } from "./lib/functions/fetch/loadContentAndSetStores"
|
||||
import { loadNavigationAndSetStores } from "./lib/functions/fetch/loadNavigationAndSetStores"
|
||||
import { loadLibraryAndSetStore } from "./lib/functions/fetch/loadLibraryAndSetStores"
|
||||
import SsrSkip from "./lib/components/SsrSkip.svelte"
|
||||
|
||||
export let url = ""
|
||||
|
||||
@ -62,6 +63,7 @@
|
||||
|
||||
<ScrollTop />
|
||||
<ScrollBottom />
|
||||
<SsrSkip />
|
||||
|
||||
<style lang="less" global>
|
||||
@import "./lib/assets/css/variables.less";
|
||||
|
18
frontend/src/lib/components/SsrSkip.svelte
Normal file
18
frontend/src/lib/components/SsrSkip.svelte
Normal file
@ -0,0 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { location } from "../store"
|
||||
|
||||
let oldPath: string
|
||||
$: if (typeof window !== "undefined" && oldPath !== $location.path) {
|
||||
const ref = oldPath ? document.location.protocol + "//" + document.location.host + oldPath : document.referrer
|
||||
oldPath = $location.path
|
||||
fetch(oldPath, {
|
||||
headers: {
|
||||
"x-ssr-skip": "204",
|
||||
"x-ssr-ref": ref,
|
||||
"x-ssr-res": `${window.innerWidth}x${window.innerHeight}`,
|
||||
// no cache
|
||||
"cache-control": "no-cache, no-store, must-revalidate",
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user