Merge pull request #56 from directus/sign-in-out

Return reactive authenticated flag on login
This commit is contained in:
Rijk van Zanten
2020-08-05 10:37:39 -04:00
committed by GitHub
2 changed files with 7 additions and 11 deletions

View File

@@ -4,7 +4,7 @@
<template v-else>
<p v-html="$t('continue_as', { name })" />
<div class="actions">
<router-link :to="signOutLink" class="sign-out">{{ $t('sign_out') }}</router-link>
<router-link to="/logout" class="sign-out">{{ $t('sign_out') }}</router-link>
<v-button large @click="hydrateAndLogin">{{ $t('continue') }}</v-button>
</div>
</template>
@@ -20,10 +20,6 @@ import router from '@/router';
export default defineComponent({
setup() {
const signOutLink = computed<string>(() => {
return `/logout`;
});
const loading = ref(false);
const error = ref(null);
const name = ref<string | null>(null);
@@ -31,7 +27,7 @@ export default defineComponent({
fetchUser();
return { name, lastPage, signOutLink, loading, error, hydrateAndLogin };
return { name, lastPage, loading, error, hydrateAndLogin };
async function fetchUser() {
loading.value = true;

View File

@@ -14,7 +14,7 @@
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api';
import { defineComponent, computed } from '@vue/composition-api';
import LoginForm from './components/login-form/';
import ContinueAs from './components/continue-as/';
import useAppStore from '../../stores/app';
@@ -32,10 +32,10 @@ export default defineComponent({
const appStore = useAppStore();
const settingsStore = useSettingsStore();
return {
authenticated: appStore.state.authenticated,
currentProject: settingsStore.state.settings,
};
const authenticated = computed(() => appStore.state.authenticated);
const currentProject = computed(() => settingsStore.state.settings);
return { authenticated, currentProject };
},
});
</script>