This repository was archived by the owner on Mar 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeView.vue
More file actions
54 lines (51 loc) · 1.53 KB
/
MeView.vue
File metadata and controls
54 lines (51 loc) · 1.53 KB
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
45
46
47
48
49
50
51
52
53
54
<template>
<div>
<h1>Информация о пользователе</h1>
<p v-if="!data">О-опс, кажется, вы еше не залогинились. Вернитесь в предыдущее меню.</p>
<ul v-else>
<li
v-for="k in Object.keys(data)"
:key="k"
>
<b>{{ k }}</b> – {{ data[k] }}
</li>
</ul>
</div>
</template>
<script>
export default {
data: () => ({
token: undefined,
data: undefined,
}),
mounted() {
let changeHeaderLayoutEvent = new CustomEvent('change-header-layout', {
detail: {
layoutName: 'back',
text: 'О пользователе',
},
});
document.dispatchEvent(changeHeaderLayoutEvent);
this.token = localStorage.getItem('auth-token');
},
watch: {
token(value) {
fetch(`${process.env.VUE_APP_API_AUTH}/me?info=groups&info=indirect_groups`, {
method: 'POST',
cache: 'no-cache',
redirect: 'follow',
headers: {
'Content-Type': 'application/json',
'Authorization': `token ${value}`,
'token': `${value}`,
},
})
.then(response => response.json())
.then(response => {
this.data = response;
});
},
},
};
</script>
<style></style>