Pinafore-Web-Client-Frontend/src/routes/_pages/index.html

40 lines
1.2 KiB
HTML

{#if $isUserLoggedIn}
<TimelineHomePage/>
{:else}
<NotLoggedInHome/>
{/if}
<script>
import NotLoggedInHome from '../_components/NotLoggedInHome.html'
import { store } from '../_store/store.js'
import TimelineHomePage from '../_components/TimelineHomePage.html'
import { observe } from 'svelte-extras'
import { showShareDialogIfNecessary } from '../_actions/showShareDialogIfNecessary'
import { doQuickLoginIfNecessary } from '../_actions/doQuickLoginIfNecessary'
export default {
async oncreate () {
doQuickLoginIfNecessary()
let observed = false
this.observe('currentVerifyCredentials', verifyCredentials => {
if (verifyCredentials && !observed) {
// when the verifyCredentials object is available, we can check to see
// if the user is trying to share something, then share it
observed = true
/* no await */ showShareDialogIfNecessary()
}
})
},
store: () => store,
computed: {
currentVerifyCredentials: ({ $currentVerifyCredentials }) => $currentVerifyCredentials
},
methods: {
observe
},
components: {
NotLoggedInHome,
TimelineHomePage
}
}
</script>