-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathLogin.vue
More file actions
44 lines (42 loc) · 843 Bytes
/
Login.vue
File metadata and controls
44 lines (42 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<template>
<div>
<h1 :style="{ textAlign: 'center' }">Welcome to Authorizer</h1>
<br />
<authorizer-root :onLogin="onLogin" />
</div>
</template>
<script>
import { inject, watch } from 'vue';
import { useRouter } from 'vue-router';
import { AuthorizerRoot } from 'authorizer-vue-ts';
export default {
name: 'Login',
components: {
'authorizer-root': AuthorizerRoot,
},
setup() {
const useAuthorizer = inject('useAuthorizer');
const { token } = useAuthorizer();
const router = useRouter();
const onLogin = () => {
console.log('test login');
};
watch(
token,
(newvalue) => {
if (newvalue) {
console.log('access token ==>> ', token.value.access_token);
router.push('/dashboard');
}
},
{
immediate: true,
}
);
return {
onLogin,
};
},
};
</script>
<style scoped></style>