File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
components/app/onboarding Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1515import SingleChoice from ' @/components/app/onboarding/SingleChoice.vue' ;
1616
1717export default {
18- props: [' slide' ],
18+ props: [' slide' , ' bus' ],
19+ data : () => ({
20+ locationData: {},
21+ }),
1922 components: {
2023 SingleChoice,
2124 },
@@ -37,18 +40,22 @@ export default {
3740 async locationAllowed (position ) {
3841 const { latitude } = position .coords ;
3942 const { longitude } = position .coords ;
40- await this .sendLocation ({ lat: latitude, lng: longitude, ip: ' 0.0.0.0' });
43+ this .locationData = { lat: latitude, lng: longitude, ip: ' 0.0.0.0' };
44+ this .$emit (' nextSlide' );
4145 },
4246 async locationDenied () {
4347 let ipRequest = await fetch (' https://api.ipify.org?format=json' );
4448 ipRequest = await ipRequest .json ();
4549 const { ip } = ipRequest;
46- await this .sendLocation ({ ip });
47- },
48- async sendLocation (data ) {
49- await this .$http .put (' /profile/edit/geolocation' , data);
50+ this .locationData = { ip };
5051 this .$emit (' nextSlide' );
5152 },
53+ async sendLocation () {
54+ await this .$http .put (' /profile/edit/geolocation' , this .locationData );
55+ },
56+ },
57+ mounted () {
58+ this .bus .$on (' sendUserLocationToBackend' , this .sendLocation );
5259 },
5360};
5461 </script >
Original file line number Diff line number Diff line change 8686 current: slideCurrent,
8787 count: slideCount,
8888 buttonText}"
89+ v-bind:bus =" bus"
8990 v-on:nextSlide =" nextSlide"
9091 v-if =" slideCurrent === 7" ></Location >
9192 <SettingUp v-if =" slideCurrent === 8" ></SettingUp >
@@ -101,6 +102,7 @@ import MainAndSecondaryImagesUpload from '@/components/app/onboarding/MainAndSec
101102import Textblock from ' @/components/app/onboarding/Textblock.vue' ;
102103import Location from " @/components/app/onboarding/Location.vue" ;
103104import SettingUp from " @/components/app/onboarding/SettingUp.vue" ;
105+ import Vue from ' vue' ;
104106
105107export default {
106108 components: {
@@ -117,6 +119,7 @@ export default {
117119 slideCount: 7 ,
118120 userData: {},
119121 userUploadedImagesCount: 0 ,
122+ bus: new Vue (),
120123 }),
121124 methods: {
122125 saveInput (... args ) {
@@ -132,6 +135,7 @@ export default {
132135 async nextSlide () {
133136 if (this .slideCurrent === this .slideCount ) {
134137 this .slideCurrent += 1 ;
138+ await this .bus .$emit (' sendUserLocationToBackend' );
135139 await this .$http .post (' /profile/complete' , this .userData );
136140 await this .$http .get (' /recommendations' );
137141 await this .$store .dispatch (' profileCompleted' );
You can’t perform that action at this time.
0 commit comments