Kobus 5 lat temu
rodzic
commit
281ab04c80

+ 8
- 0
src/assets/staticData/alertTypes.js Wyświetl plik

1
+const types = Object.freeze({
2
+  SUCCESS: 'Success',
3
+  INFO: 'Info',
4
+  WARNING: 'Warning',
5
+  ERROR: 'Error',
6
+});
7
+
8
+export default types;

+ 44
- 0
src/components/shared/alert.vue Wyświetl plik

1
+<template>
2
+  <div class="container">
3
+    <!-- eslint-disable max-len -->
4
+    <div class="alert alert-success" v-if="type === 'SUCCESS'">
5
+      <eva-icon name="checkmark-outline"></eva-icon>
6
+      <strong>{{ text }}</strong>
7
+    </div>
8
+    <div class="alert alert-info" v-if="type === 'INFO'">
9
+      <eva-icon name="info-outline"></eva-icon>
10
+      <strong>{{ text }}</strong>
11
+    </div>
12
+    <div class="alert alert-warning" v-if="type === 'WARNING'">
13
+      <eva-icon name="alert-circle-outline"></eva-icon>
14
+      <strong>{{ text }}</strong>
15
+    </div>
16
+    <div class="alert alert-danger" v-if="type === 'ERROR'">
17
+      <eva-icon name="slash-outline"></eva-icon>
18
+      <strong>{{ text }}</strong>
19
+    </div>
20
+  </div>
21
+</template>
22
+
23
+<script>
24
+export default {
25
+  name: 'Alert',
26
+  data() {
27
+    return {
28
+      alertTypes: {
29
+        SUCCESS: 'Success',
30
+        INFO: 'Info',
31
+        WARNING: 'Warning',
32
+        ERROR: 'Error',
33
+      },
34
+    };
35
+  },
36
+  props: {
37
+    text: null,
38
+    type: null,
39
+  },
40
+};
41
+</script>
42
+
43
+<style>
44
+</style>

+ 20
- 5
src/components/shared/navBar.vue Wyświetl plik

60
                   @click="routerGoTo('/timeshare/sell')"
60
                   @click="routerGoTo('/timeshare/sell')"
61
                 >To Sell</a>
61
                 >To Sell</a>
62
                 <a
62
                 <a
63
+                  v-if="showLogout"
63
                   class="dropdown-item cursor-pointer"
64
                   class="dropdown-item cursor-pointer"
64
                   @click="routerGoTo('/timeshare/sell')"
65
                   @click="routerGoTo('/timeshare/sell')"
65
                 >My Timeshare Weeks</a>
66
                 >My Timeshare Weeks</a>
103
                   class="dropdown-item cursor-pointer"
104
                   class="dropdown-item cursor-pointer"
104
                   @click="routerGoTo('/property/Residential/Rental')"
105
                   @click="routerGoTo('/property/Residential/Rental')"
105
                 >To Rent Residential Properties</a>
106
                 >To Rent Residential Properties</a>
106
-                <hr />
107
+                <hr v-if="showLogout" />
107
                 <a
108
                 <a
109
+                  v-if="showLogout"
108
                   class="dropdown-item cursor-pointer"
110
                   class="dropdown-item cursor-pointer"
109
                   @click="routerGoTo('/property/list/Commercial/MyListings')"
111
                   @click="routerGoTo('/property/list/Commercial/MyListings')"
110
                 >My Commercial Properties</a>
112
                 >My Commercial Properties</a>
111
                 <a
113
                 <a
114
+                  v-if="showLogout"
112
                   class="dropdown-item cursor-pointer"
115
                   class="dropdown-item cursor-pointer"
113
                   @click="routerGoTo('/property/list/Residential/MyListings')"
116
                   @click="routerGoTo('/property/list/Residential/MyListings')"
114
                 >My Residential Properties</a>
117
                 >My Residential Properties</a>
184
             <li class="nav-item dropdown">
187
             <li class="nav-item dropdown">
185
               <a
188
               <a
186
                 class="nav-link"
189
                 class="nav-link"
190
+                v-if="hideLogin"
187
                 @click="routerGoTo('/user/login')"
191
                 @click="routerGoTo('/user/login')"
188
                 id="navbarDropdown"
192
                 id="navbarDropdown"
189
                 role="button"
193
                 role="button"
192
                 aria-expanded="false"
196
                 aria-expanded="false"
193
               >Login</a>
197
               >Login</a>
194
             </li>
198
             </li>
199
+            <li class="nav-item dropdown">
200
+              <span v-if="showLogout">
201
+                <a class="nav-link" @click="logout()">Logout</a>
202
+              </span>
203
+              <span v-else></span>
204
+            </li>
205
+            <li>
206
+              <span v-if="showLogout">
207
+                <a>Welcome! {{ }}</a>
208
+              </span>
209
+              <span v-else></span>
210
+            </li>
195
           </ul>
211
           </ul>
196
         </div>
212
         </div>
197
       </div>
213
       </div>
207
         </button>
223
         </button>
208
       </div>
224
       </div>
209
     </div>
225
     </div>
210
-    <span v-if="showLogout">
211
-      <a @click="logout()">Logout</a>
212
-    </span>
213
-    <span v-else></span>
214
   </nav>
226
   </nav>
215
 </template>
227
 </template>
216
 
228
 
225
     showLogout() {
237
     showLogout() {
226
       return this.$store.state.authentication.status === 'success';
238
       return this.$store.state.authentication.status === 'success';
227
     },
239
     },
240
+    hideLogin() {
241
+      return this.$store.state.authentication.status !== 'success';
242
+    },
228
     Logout() {
243
     Logout() {
229
       return this.$store.state.authentication.methods.logout;
244
       return this.$store.state.authentication.methods.logout;
230
     },
245
     },

+ 10
- 2
src/components/user/loginPage.vue Wyświetl plik

8
             <h4>Login</h4>
8
             <h4>Login</h4>
9
             <br />
9
             <br />
10
           </div>
10
           </div>
11
+          <!-- <alert :text="'Login successful'" :type="'SUCCESS'" />
12
+          <alert :text="'User does not exist, please register'" :type="'ERROR'" />
13
+          <alert :text="'Username is incorrect'" :type="'WARNING'" />
14
+          <alert :text="'Password is incorrect'" :type="'WARNING'" />
15
+          <alert :text="'Caps Lock is on'" :type="'INFO'" />-->
11
           <div class="row">
16
           <div class="row">
12
             <div class="col-md-11" style="margin-bottom: 1em">
17
             <div class="col-md-11" style="margin-bottom: 1em">
13
               <div class="input-group mb-3">
18
               <div class="input-group mb-3">
76
         <div class="form">
81
         <div class="form">
77
           <h5>Trouble signing in?</h5>
82
           <h5>Trouble signing in?</h5>
78
           <div>
83
           <div>
84
+            <!-- <alert :text="'Username & password request email sent'" :type="'SUCCESS'" /> -->
79
             <div class="row">
85
             <div class="row">
80
               <div class="input-group-prepend">
86
               <div class="input-group-prepend">
81
                 <span class="input-group-text">
87
                 <span class="input-group-text">
97
 
103
 
98
 <script>
104
 <script>
99
 import { mapActions, mapState } from 'vuex';
105
 import { mapActions, mapState } from 'vuex';
100
-// import axios from 'axios';
101
-// import User from '../../assets/Log';
106
+// import alert from '../shared/alert.vue';
102
 
107
 
103
 export default {
108
 export default {
104
   name: 'Login',
109
   name: 'Login',
110
+  components: {
111
+    // alert,
112
+  },
105
   data() {
113
   data() {
106
     return {
114
     return {
107
       username: '',
115
       username: '',

+ 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
     },
8
     },

Ładowanie…
Anuluj
Zapisz