Add login route and logout page
This commit is contained in:
parent
0190ed596e
commit
95b517d620
@ -54,7 +54,7 @@ app.use(
|
||||
createAuth0({
|
||||
domain: 'dev-ge84r-eu.us.auth0.com',
|
||||
client_id: 'zHjZGg1uPws0DkQg5bRdKcDX8m6AuTZl', // eslint-disable-line camelcase
|
||||
redirect_uri: window.location.origin, // eslint-disable-line camelcase
|
||||
redirect_uri: window.location.origin + '/auth', // eslint-disable-line camelcase
|
||||
}),
|
||||
)
|
||||
|
||||
|
19
src/pages/Auth.vue
Normal file
19
src/pages/Auth.vue
Normal file
@ -0,0 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { useAuth0 } from '@auth0/auth0-vue';
|
||||
import router from '../router';
|
||||
|
||||
const { user, isAuthenticated, logout } = useAuth0();
|
||||
isAuthenticated
|
||||
const route = router.resolve({ path: '/'})
|
||||
const absoluteURL = new URL(route.href, window.location.href).href
|
||||
const leave = () => logout({ returnTo: absoluteURL })
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<h2>User Profile</h2>
|
||||
<code>{{ user }}</code>
|
||||
<button @click="leave">Log out</button>
|
||||
</div>
|
||||
</template>
|
@ -17,6 +17,11 @@ const routes = [
|
||||
name: 'Editor',
|
||||
component: () => import('./pages/Editor.vue'),
|
||||
},
|
||||
{
|
||||
path:'/auth',
|
||||
name: 'Auth',
|
||||
component: () => import('./pages/Auth.vue'),
|
||||
},
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
|
Loading…
Reference in New Issue
Block a user