Przeglądaj źródła

Merge Conflicts on Individual and authenticate

master
Lene Scholtz 5 lat temu
rodzic
commit
56718cddef

+ 0
- 3
src/components/timeshare/resort/resortImage.vue Wyświetl plik

19
 import { mapState } from 'vuex';
19
 import { mapState } from 'vuex';
20
 
20
 
21
 export default {
21
 export default {
22
-  props: {
23
-    images: [],
24
-  },
25
   data() {
22
   data() {
26
     return {
23
     return {
27
       largeImg: 0,
24
       largeImg: 0,

+ 5
- 1
src/components/timeshare/sell/sellPage.vue Wyświetl plik

521
     DetailIndividual,
521
     DetailIndividual,
522
     Alert,
522
     Alert,
523
   },
523
   },
524
+  mounted() {
525
+    this.getIndividual(this.user.id);
526
+  },
524
   created() {
527
   created() {
525
-    console.log(46);
526
     this.initTimeshare(this.weekId);
528
     this.initTimeshare(this.weekId);
527
   },
529
   },
528
   computed: {
530
   computed: {
539
       'agencies',
541
       'agencies',
540
       'agents',
542
       'agents',
541
     ]),
543
     ]),
544
+    ...mapState('individual', ['item']),
542
     ...mapState('authentication', ['isLoggedIn']),
545
     ...mapState('authentication', ['isLoggedIn']),
543
     ...mapGetters({
546
     ...mapGetters({
544
       user: 'authentication/getUser',
547
       user: 'authentication/getUser',
570
     },
573
     },
571
   },
574
   },
572
   methods: {
575
   methods: {
576
+    ...mapActions('individual', ['getIndividual']),
573
     submitSale() {
577
     submitSale() {
574
       if (this.isLoggedIn) {
578
       if (this.isLoggedIn) {
575
         this.saveWeek(this.sellItem);
579
         this.saveWeek(this.sellItem);

+ 12
- 14
src/components/user/loginPage.vue Wyświetl plik

107
   },
107
   },
108
   data() {
108
   data() {
109
     return {
109
     return {
110
+      username: '',
111
+      password: '',
110
       isPasswordShown: 'password',
112
       isPasswordShown: 'password',
111
       selectItems: [{ text: 'password', value: 0 }],
113
       selectItems: [{ text: 'password', value: 0 }],
112
       selectErrors: 'Some error with the field',
114
       selectErrors: 'Some error with the field',
119
     };
121
     };
120
   },
122
   },
121
   computed: {
123
   computed: {
122
-    ...mapState('authentication', ['token', 'status', 'username', 'password']),
124
+    ...mapState('authentication', ['token', 'status']),
123
   },
125
   },
124
   methods: {
126
   methods: {
125
     ...mapActions('authentication', ['login', 'init']),
127
     ...mapActions('authentication', ['login', 'init']),
129
       } else this.troubleToggle = true;
131
       } else this.troubleToggle = true;
130
     },
132
     },
131
     Login() {
133
     Login() {
132
-      console.log(this.$store.state.authentication);
133
-
134
-      this.login().then(() => {
135
-        console.log('this');
136
-        console.log(this);
137
-        console.log(this.$store.state.authentication.status);
138
-
139
-        if (this.$store.state.authentication.status === 'error') {
140
-          this.$router.push('/user/login');
141
-        } else {
142
-          this.$router.push('/about/us');
143
-        }
144
-      });
134
+      this.login({ username: this.username, password: this.password }).then(
135
+        () => {
136
+          if (this.$store.state.authentication.status === 'error') {
137
+            this.$router.push('/user/login');
138
+          } else {
139
+            this.$router.push('/about/us');
140
+          }
141
+        },
142
+      );
145
     },
143
     },
146
     togglePassword() {
144
     togglePassword() {
147
       this.showPassword = true;
145
       this.showPassword = true;

+ 3
- 5
src/store/modules/user/authentication.js Wyświetl plik

7
 export default {
7
 export default {
8
   namespaced: true,
8
   namespaced: true,
9
   state: {
9
   state: {
10
-    username: 'UniVate2018',
11
-    password: 'UniVate2018',
12
     isLoggedIn: log.isLoggedIn(),
10
     isLoggedIn: log.isLoggedIn(),
13
     flag: false,
11
     flag: false,
14
     status: undefined,
12
     status: undefined,
66
         agency: log.getJSONObject('agency'),
64
         agency: log.getJSONObject('agency'),
67
       });
65
       });
68
     },
66
     },
69
-    login({ commit, state }) {
67
+    login({ commit }, user) {
70
       axios({
68
       axios({
71
         url: '/api/register/authenticate',
69
         url: '/api/register/authenticate',
72
         data: {
70
         data: {
73
-          username: state.username,
74
-          password: state.password,
71
+          username: user.username,
72
+          password: user.password,
75
         },
73
         },
76
         method: 'POST',
74
         method: 'POST',
77
       })
75
       })

+ 8
- 3
src/store/modules/user/individual.js Wyświetl plik

6
   namespaced: true,
6
   namespaced: true,
7
   state: {
7
   state: {
8
     items: [],
8
     items: [],
9
-    item: undefined,
9
+    indiv: undefined,
10
   },
10
   },
11
   mutations: {
11
   mutations: {
12
     addItem(state, item) {
12
     addItem(state, item) {
18
   },
18
   },
19
   getters: {},
19
   getters: {},
20
   actions: {
20
   actions: {
21
-    getIndividual({ commit }, userId) {
21
+    getIndividual({ commit, rootGetters }, userId) {
22
+      let id = 0;
23
+      if (!userId || userId === 0) {
24
+        const rootItem = rootGetters['authentication/getUser'];
25
+        id = rootItem ? rootItem.id : 0;
26
+      } else id = userId;
22
       axios
27
       axios
23
-        .get(`/api/individual/getIndividual/${userId}`)
28
+        .get(`/api/individual/getIndividual/${id}`)
24
         .then(r => commit('setItem', {
29
         .then(r => commit('setItem', {
25
             name: 'indiv',
30
             name: 'indiv',
26
             value: r.data,
31
             value: r.data,

+ 1
- 1
vue.config.js Wyświetl plik

2
   devServer: {
2
   devServer: {
3
     proxy: {
3
     proxy: {
4
       '/api': {
4
       '/api': {
5
-        target: 'http://192.168.6.188:5000',
5
+        target: 'http://localhost:57260',
6
         changeOrigin: true,
6
         changeOrigin: true,
7
       },
7
       },
8
       '/nph-srep': {
8
       '/nph-srep': {

Ładowanie…
Anuluj
Zapisz