Kaynağa Gözat

remove easy code

master
Kobus 5 yıl önce
ebeveyn
işleme
e7d40da6cc

+ 5
- 1
src/components/timeshare/sell/sellPage.vue Dosyayı Görüntüle

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

+ 12
- 15
src/components/user/loginPage.vue Dosyayı Görüntüle

@@ -107,6 +107,8 @@ export default {
107 107
   },
108 108
   data() {
109 109
     return {
110
+      username: '',
111
+      password: '',
110 112
       isPasswordShown: 'password',
111 113
       selectItems: [{ text: 'password', value: 0 }],
112 114
       selectErrors: 'Some error with the field',
@@ -119,7 +121,7 @@ export default {
119 121
     };
120 122
   },
121 123
   computed: {
122
-    ...mapState('authentication', ['token', 'status', 'username', 'password']),
124
+    ...mapState('authentication', ['token', 'status']),
123 125
   },
124 126
   methods: {
125 127
     ...mapActions('authentication', ['login', 'init']),
@@ -129,20 +131,15 @@ export default {
129 131
       } else this.troubleToggle = true;
130 132
     },
131 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
-          console.log('yippy tequila');
143
-          this.$router.push('/about/us');
144
-        }
145
-      });
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
+      );
146 143
     },
147 144
     togglePassword() {
148 145
       this.showPassword = true;

+ 3
- 6
src/store/modules/user/authentication.js Dosyayı Görüntüle

@@ -7,8 +7,6 @@ Vue.use(Vuex);
7 7
 export default {
8 8
   namespaced: true,
9 9
   state: {
10
-    username: 'kobusb',
11
-    password: '123123',
12 10
     isLoggedIn: log.isLoggedIn(),
13 11
     flag: false,
14 12
     status: undefined,
@@ -70,13 +68,12 @@ export default {
70 68
     },
71 69
     login({
72 70
       commit,
73
-      state,
74
-    }) {
71
+    }, user) {
75 72
       axios({
76 73
         url: '/api/register/authenticate',
77 74
         data: {
78
-          username: state.username,
79
-          password: state.password,
75
+          username: user.username,
76
+          password: user.password,
80 77
         },
81 78
         method: 'POST',
82 79
       })

+ 7
- 1
src/store/modules/user/individual.js Dosyayı Görüntüle

@@ -20,9 +20,15 @@ export default {
20 20
   actions: {
21 21
     getIndividual({
22 22
       commit,
23
+      rootGetters,
23 24
     }, userId) {
25
+      let id = 0;
26
+      if (!userId || userId === 0) {
27
+        const rootItem = rootGetters['authentication/getUser'];
28
+        id = rootItem ? rootItem.id : 0;
29
+      } else id = userId;
24 30
       axios
25
-        .get(`/api/individual/getIndividual/${userId}`)
31
+        .get(`/api/individual/getIndividual/${id}`)
26 32
         .then(r => commit('setItem', {
27 33
           name: 'item',
28 34
           value: r.data,

+ 1
- 1
vue.config.js Dosyayı Görüntüle

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

Loading…
İptal
Kaydet