|
31 | 31 | <AccountInput |
32 | 32 | v-bind:name="'First Name'" |
33 | 33 | v-bind:type="'firstName'" |
| 34 | + v-on:saveSingleChoice="saveSingleChoice" |
34 | 35 | v-bind:currentValuePassed="this.$store.getters.getLoggedInUser.first_name"></AccountInput> |
35 | 36 | <AccountInput |
36 | 37 | v-bind:name="'Last Name'" |
37 | 38 | v-bind:type="'lastName'" |
| 39 | + v-on:saveSingleChoice="saveSingleChoice" |
38 | 40 | v-bind:currentValuePassed="this.$store.getters.getLoggedInUser.last_name"></AccountInput> |
39 | 41 | <AccountInput |
40 | 42 | v-bind:name="'Email'" |
41 | 43 | v-bind:type="'email'" |
| 44 | + v-on:saveSingleChoice="saveSingleChoice" |
42 | 45 | v-bind:currentValuePassed="this.$store.getters.getLoggedInUser.email"></AccountInput> |
43 | 46 | <AccountInput |
44 | 47 | v-bind:name="'Username'" |
45 | 48 | v-bind:type="'username'" |
| 49 | + v-on:saveSingleChoice="saveSingleChoice" |
46 | 50 | v-bind:currentValuePassed="this.$store.getters.getLoggedInUser.username"></AccountInput> |
47 | 51 | <AccountInput |
48 | 52 | v-bind:name="'Password'" |
49 | 53 | v-bind:type="'password'" |
| 54 | + v-on:saveSingleChoice="saveSingleChoice" |
50 | 55 | v-bind:currentValuePassed="''"></AccountInput> |
51 | 56 | </section> |
52 | 57 | <section v-if="getShow === 'profile'" class="flex flex-col items-start z-10 absolute bg-white-matcha w-full top-0 left-0 md:ml-4 md:relative md:shadow-md md:rounded-md"> |
|
68 | 73 | <DropdownDisplayChoice |
69 | 74 | class="inline-block" |
70 | 75 | v-on:saveSingleChoice="saveSingleChoice" |
71 | | - v-bind:name="'gender'" |
| 76 | + v-bind:name="'sexuality'" |
72 | 77 | v-bind:starting-option="this.$store.getters.getLoggedInUser.orientation" |
73 | 78 | v-bind:options="['heterosexual', 'homosexual', 'bisexual', 'other']"></DropdownDisplayChoice> |
74 | 79 | </div> |
|
99 | 104 | class="mx-auto" |
100 | 105 | v-bind:name="'Bio'" |
101 | 106 | v-bind:type="'bio'" |
| 107 | + v-on:saveSingleChoice="saveSingleChoice" |
102 | 108 | v-bind:currentValuePassed="this.$store.getters.getLoggedInUser.bio"></AccountInput> |
103 | 109 | </div> |
104 | 110 | <div class="text-center px-8 py-8 border-t border-gray-300 w-full"> |
|
129 | 135 |
|
130 | 136 | <script> |
131 | 137 | /* eslint-disable prefer-destructuring */ |
| 138 | +/* eslint-disable prefer-const */ |
132 | 139 | import NavBar from '@/components/shared/NavBar.vue'; |
133 | 140 | import MenuButton from '@/components/app/settings/MenuButton.vue'; |
134 | 141 | import SectionHeader from '@/components/app/settings/SectionHeader.vue'; |
@@ -219,17 +226,35 @@ export default { |
219 | 226 | const user = await this.$http.get(`/users/${this.$store.getters.getLoggedInUser.id}`); |
220 | 227 | await this.$store.dispatch('login', user.data); |
221 | 228 | }, |
222 | | - saveSingleChoice(...args) { |
| 229 | + async saveSingleChoice(...args) { |
223 | 230 | const [key, value] = args; |
224 | | - if (key === 'gender') { |
225 | | - console.log(value); |
| 231 | + if (key === 'firstName') { |
| 232 | + await this.$http.patch('/profile/edit/first_name', { first_name: value }); |
| 233 | + } else if (key === 'lastName') { |
| 234 | + await this.$http.patch('/profile/edit/last_name', { last_name: value }); |
| 235 | + } else if (key === 'email') { |
| 236 | + await this.$http.patch('/profile/edit/email', { email: value }); |
| 237 | + } else if (key === 'username') { |
| 238 | + await this.$http.patch('/profile/edit/username', { username: value }); |
| 239 | + } else if (key === 'password') { |
| 240 | + await this.$http.patch('/profile/edit/password', { password: value }); |
| 241 | + } else if (key === 'bio') { |
| 242 | + await this.$http.patch('/profile/edit/bio', { bio: value }); |
| 243 | + } else if (key === 'gender') { |
| 244 | + await this.$http.patch('/profile/edit/gender', { gender: value }); |
| 245 | + } else if (key === 'sexuality') { |
| 246 | + await this.$http.patch('/profile/edit/orientation', { orientation: value }); |
226 | 247 | } |
| 248 | + const user = await this.$http.get(`/users/${this.$store.getters.getLoggedInUser.id}`); |
| 249 | + await this.$store.dispatch('login', user.data); |
227 | 250 | }, |
228 | | - saveMultipleChoice(...args) { |
| 251 | + async saveMultipleChoice(...args) { |
229 | 252 | const [key, value] = args; |
230 | 253 | if (key === 'interests') { |
231 | | - console.log(value); |
| 254 | + await this.$http.patch('/profile/edit/tags', { tags: value }); |
232 | 255 | } |
| 256 | + const user = await this.$http.get(`/users/${this.$store.getters.getLoggedInUser.id}`); |
| 257 | + await this.$store.dispatch('login', user.data); |
233 | 258 | }, |
234 | 259 | showSetting(setting) { |
235 | 260 | this.show = setting; |
|
0 commit comments