Last active
April 6, 2018 12:02
-
-
Save postb99/d5a107d67dd2b126741e09accbf5f7c9 to your computer and use it in GitHub Desktop.
vue-adal (working)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div v-if="isAuthenticated" id="app" class="container-fluid"> | |
<div id="mainTitle"> | |
Hello World | |
</div> | |
<router-view/> | |
</div> | |
</template> | |
<script lang="ts"> | |
import Vue from 'vue' | |
import Component from 'vue-class-component' | |
import router from './router' | |
import Adal from 'vue-adal' | |
Vue.use(Adal, { | |
// This config gets passed along to Adal, so all settings available to adal can be used here. | |
config: { | |
... | |
}, | |
// Set this to true for authentication on startup | |
requireAuthOnInitialize: true, | |
// Pass a vue-router object in to add route hooks with authentication and role checking | |
router: router | |
}) | |
export default Vue.extend({ | |
name: 'app', | |
computed: { | |
isAuthenticated() { | |
return this.$adal.isAuthenticated() | |
} | |
}, | |
methods: { | |
logOut() { | |
this.$adal.logout() | |
} | |
} | |
}) | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment