1 | <script>
|
---|
2 |
|
---|
3 |
|
---|
4 | export default {
|
---|
5 | data() {
|
---|
6 | return {
|
---|
7 | path: '',
|
---|
8 | url: 'http://localhost:8080/api/auth/register/',
|
---|
9 | form_info:{
|
---|
10 | firstName: '',
|
---|
11 | lastName: '',
|
---|
12 | email: '',
|
---|
13 | password: '',
|
---|
14 | phoneNumber: '',
|
---|
15 |
|
---|
16 | },
|
---|
17 | data: {}
|
---|
18 |
|
---|
19 | }
|
---|
20 | },
|
---|
21 |
|
---|
22 | methods: {
|
---|
23 | register() {
|
---|
24 | fetch(this.url+this.path, {
|
---|
25 | method: 'POST',
|
---|
26 | headers: { "Content-Type": "application/json" },
|
---|
27 | body: JSON.stringify({firstName: this.firstName, lastName: this.lastName, email: this.email, password: this.password})
|
---|
28 | }).then((response) => {response.json()})
|
---|
29 | .then((json) => this.data = json)
|
---|
30 |
|
---|
31 | }
|
---|
32 |
|
---|
33 | },
|
---|
34 | /*computed: {
|
---|
35 | somevariabletest(){
|
---|
36 | return this.url+this.path;
|
---|
37 | }
|
---|
38 | }*/
|
---|
39 |
|
---|
40 |
|
---|
41 | }
|
---|
42 |
|
---|
43 |
|
---|
44 |
|
---|
45 | </script>
|
---|
46 |
|
---|
47 | <template>
|
---|
48 | <div class="container-xxl">
|
---|
49 | <div class="row justify-content-center">
|
---|
50 |
|
---|
51 |
|
---|
52 | <div class="col-3">
|
---|
53 | <form @submit.prevent="register()" method="POST">
|
---|
54 | <label for="name" class="form-label" >Name</label>
|
---|
55 | <input v-model="form_info.firstName" type="text" id="name" name="firstName" class="form-control" placeholder="Name" required>
|
---|
56 |
|
---|
57 | <label for="surname" class="form-label">Surname</label>
|
---|
58 | <input v-model="form_info.lastName" type="text" id="surname" name="lastName" class="form-control" placeholder="Surname" required>
|
---|
59 |
|
---|
60 | <label for="phone_number" class="form-label">Phone Number</label>
|
---|
61 | <input v-model="form_info.phoneNumber" type="text" id="phone_number" name="phoneNumber" class="form-control" required>
|
---|
62 |
|
---|
63 | <label for="email" class="form-label">Email Address</label>
|
---|
64 | <input v-model="form_info.email" type="email" id="email" name="email" class="form-control" placeholder="someone@example.com" required>
|
---|
65 |
|
---|
66 | <label for="password" class="form-label">Password</label>
|
---|
67 | <input v-model="form_info.password" type="password" id="password" name="password" class="form-control">
|
---|
68 |
|
---|
69 | <label for="role" class="form-label">Role</label>
|
---|
70 | <select class="form-control" id="role" v-model="path">
|
---|
71 |
|
---|
72 | <option value="customer">Customer</option>
|
---|
73 |
|
---|
74 | <option value="local-worker">Local Worker</option>
|
---|
75 |
|
---|
76 | <option value="local-manager">Local Manager</option>
|
---|
77 |
|
---|
78 | </select>
|
---|
79 |
|
---|
80 | <button type="submit" class="btn btn-dark">Register</button>
|
---|
81 | </form>
|
---|
82 | </div>
|
---|
83 |
|
---|
84 | </div>
|
---|
85 |
|
---|
86 |
|
---|
87 | </div>
|
---|
88 |
|
---|
89 | </template>
|
---|
90 |
|
---|
91 | <style scoped>
|
---|
92 |
|
---|
93 | </style>
|
---|