forked from cms/tibi-svelte-starter
Aktualisiere Metriken-Logik in App.svelte zur Verwendung von $effect und verbessere die Lesbarkeit
This commit is contained in:
@@ -16,9 +16,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// metrics
|
// metrics
|
||||||
let oldPath: string
|
let oldPath = $state("")
|
||||||
$: if (metricCall && typeof window !== "undefined" && oldPath !== $location.path) {
|
$effect(() => {
|
||||||
const ref = oldPath ? document.location.protocol + "//" + document.location.host + oldPath : document.referrer
|
if (metricCall && typeof window !== "undefined" && oldPath !== $location.path) {
|
||||||
|
const ref = oldPath
|
||||||
|
? document.location.protocol + "//" + document.location.host + oldPath
|
||||||
|
: document.referrer
|
||||||
oldPath = $location.path
|
oldPath = $location.path
|
||||||
const fetchPath = oldPath + (oldPath.includes("?") ? "&" : "?") + "metrics"
|
const fetchPath = oldPath + (oldPath.includes("?") ? "&" : "?") + "metrics"
|
||||||
fetch(fetchPath, {
|
fetch(fetchPath, {
|
||||||
@@ -31,6 +34,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>Tibi Svelte Starter</h1>
|
<h1>Tibi Svelte Starter</h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user