Weired fucking fix for the userstore data not being instantly loaded....
ref #1
This commit is contained in:
parent
4f5b7f38fb
commit
cd3508dcb6
|
@ -1,8 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import Apiclient from '$lib/Apiclient';
|
import Apiclient from '$lib/Apiclient';
|
||||||
|
import UserStore from '$lib/UserStore';
|
||||||
|
import { onDestroy } from 'svelte';
|
||||||
|
|
||||||
let shortcode = $page.query.get('shortcode');
|
let shortcode = $page.query.get('shortcode');
|
||||||
|
|
||||||
$: urlDetails = {
|
$: urlDetails = {
|
||||||
shortcode: 'Loading...',
|
shortcode: 'Loading...',
|
||||||
url: 'Loading...',
|
url: 'Loading...',
|
||||||
|
@ -10,13 +13,20 @@
|
||||||
visits: 'Loading...'
|
visits: 'Loading...'
|
||||||
};
|
};
|
||||||
$: urlVisists = [];
|
$: urlVisists = [];
|
||||||
|
let visitQuery;
|
||||||
|
|
||||||
Apiclient.getUrlDetails(shortcode).then((res) => {
|
const unsubscribe = UserStore.subscribe((value) => {
|
||||||
urlDetails = res;
|
if (value.isLoggedIn) {
|
||||||
});
|
Apiclient.getUrlDetails(shortcode).then((res) => {
|
||||||
let visitQuery = Apiclient.getUrlVisits(shortcode).then((res) => {
|
urlDetails = res;
|
||||||
urlVisists = res;
|
});
|
||||||
|
visitQuery = Apiclient.getUrlVisits(shortcode).then((res) => {
|
||||||
|
urlVisists = res;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onDestroy(unsubscribe);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h2 class="text-3xl font-bold text-gray-800 dark:text-gray-100 pb-6">Details: {shortcode}</h2>
|
<h2 class="text-3xl font-bold text-gray-800 dark:text-gray-100 pb-6">Details: {shortcode}</h2>
|
||||||
|
|
Loading…
Reference in New Issue