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 pathRegisterView.vue
More file actions
118 lines (115 loc) · 3.69 KB
/
RegisterView.vue
File metadata and controls
118 lines (115 loc) · 3.69 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<template>
<div class="container">
<h1>Регистрация в приложение</h1>
<p>
Добро пожаловать! Тут находится наша нулевая итерация по прикручиванию авторизации в приложение. Ниже вы
можете зарегистрироваться.
</p>
<form @submit.prevent="register">
<div class="mb-3 row">
<label
for="staticEmail"
class="col-sm-2 col-form-label"
>
Email
</label>
<div class="col-sm-10">
<input
type="text"
class="form-control"
id="staticEmail"
placeholder="email@example.com"
v-model="email"
/>
</div>
</div>
<div class="mb-3 row">
<label
for="inputPassword"
class="col-sm-2 col-form-label"
>
Password
</label>
<div class="col-sm-10">
<input
type="password"
class="form-control"
id="inputPassword"
v-model="password"
/>
</div>
</div>
<div class="mb-3 row">
<label
for="reinputPassword"
class="col-sm-2 col-form-label"
>
Re-type Password
</label>
<div class="col-sm-10">
<input
type="password"
class="form-control"
id="reinputPassword"
v-model="repassword"
/>
</div>
</div>
<div class="row p-4">
<button
type="submit"
class="btn btn-success my-2"
>
Зарегистрироваться
</button>
<RouterLink
to="/devtools"
class="btn btn-secondary my-2"
>
Вернуться назад
</RouterLink>
</div>
</form>
</div>
</template>
<script>
export default {
data: () => ({
email: '',
password: '',
repassword: '',
}),
mounted() {
let changeHeaderLayoutEvent = new CustomEvent('change-header-layout', {
detail: {
layoutName: 'back',
text: 'О пользователе',
},
});
document.dispatchEvent(changeHeaderLayoutEvent);
},
methods: {
register() {
if (this.password !== this.repassword) {
alert('Пароли не совпадают');
return;
}
fetch(`${process.env.VUE_APP_API_AUTH}/email/registration`, {
method: 'POST',
cache: 'no-cache',
redirect: 'follow',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: this.email,
password: this.password,
}),
})
.then(response => response.text())
.then(response => {
alert(response);
});
},
},
};
</script>
<style></style>