Bläddra i källkod

:sparkles: login vue using wave componens

tags/0.0.1^2
J 3 år sedan
förälder
incheckning
03a28671cc

+ 9
- 1
frontend/src/App.vue Visa fil

@@ -21,7 +21,8 @@ import TopNav from './components/TopNav.vue'
21 21
 import { currentProfile } from './services'
22 22
 import { surveyFactory } from './utils'
23 23
 
24
-const DEV_MODE = import.meta.env.VITE_DEV == 'true'
24
+// const DEV_MODE = import.meta.env.VITE_DEV == 'true'
25
+const DEV_MODE = false
25 26
 const DEV_PID = 45
26 27
 
27 28
 export default {
@@ -57,8 +58,15 @@ export default {
57 58
             if (currentProfile.isLoggedIn) {
58 59
                 currentProfile.logout()
59 60
             }
61
+
60 62
             await currentProfile.login(profileId, this.$waveui.notify)
61 63
             console.log('---')
64
+
65
+            /**
66
+             * Default to the HomeView and alter as needed (side-effects!)
67
+             */
68
+            const toRoute = { name: 'HomeView' }
69
+            this.$router.push(toRoute)
62 70
         },
63 71
     },
64 72
 }

+ 1
- 1
frontend/src/views/ChatView.vue Visa fil

@@ -23,7 +23,7 @@ main.view--chat
23 23
         button(@click="sendMessage") send
24 24
 
25 25
     p(v-else-if="profile.isLoggedIn && !target") No match found between profile {{ $route.params.pid }} and {{profile.id}}... 
26
-    p(v-else) Loading...
26
+    w-spinner(v-else bounce)
27 27
 
28 28
     MainNav
29 29
 </template>

+ 1
- 1
frontend/src/views/HomeView.vue Visa fil

@@ -5,7 +5,7 @@ main.view--home
5 5
         ProfileCardList(:pid='pid' :cards='cards' @reload='getCards')
6 6
 
7 7
     p(v-else-if='cards.length === 0') No profiles in match_queue.
8
-    p(v-else) Loading...
8
+    w-spinner(v-else bounce)
9 9
 
10 10
     footer
11 11
         w-form

+ 5
- 30
frontend/src/views/LoginView.vue Visa fil

@@ -1,46 +1,21 @@
1 1
 <template lang="pug">
2 2
 main.view--login
3
-    header
4
-        h2 Login
5 3
 
6
-    article
7
-        form(@submit.prevent="onSubmit")
8
-            label profile id:
9
-            input(required="" type="profileId" v-model="form.profileId")
4
+    article.pa12
5
+        form
6
+            w-input.mb4(label="User E-mail" tile outline v-model="form.profileId" inner-icon-left='mdi mdi-mail')
7
+            w-input(label="Password" type="password" tile outline inner-icon-left='mdi mdi-eye-off')
10 8
 
11 9
             //- Emit up an event so we can sync App pid with currentProfile.id
12
-            button(@click="$emit('updatePid', form.profileId)" type="submit") submit
10
+            w-button.xs12.mt12(@click="$emit('updatePid', form.profileId)" type="submit") submit
13 11
 </template>
14 12
 
15 13
 <script>
16
-import { currentProfile } from '../services'
17
-
18 14
 export default {
19 15
     data: () => ({
20 16
         form: {
21 17
             profileId: null,
22 18
         },
23 19
     }),
24
-    methods: {
25
-        async onSubmit() {
26
-            if (!this.form.profileId) console.error('No profile in form')
27
-
28
-            /**
29
-             * Default to the HomeView and alter as needed (side-effects!)
30
-             */
31
-            const toRoute = { name: 'HomeView' }
32
-
33
-            /**
34
-             * Profile needs a complete survey and
35
-             * alters the url if it's incomplete
36
-             */
37
-            const alreadyLoggedIn = await currentProfile.isLoggedIn
38
-            if (!alreadyLoggedIn) {
39
-                await currentProfile.login(this.form.profileId)
40
-            }
41
-
42
-            this.$router.push(toRoute)
43
-        },
44
-    },
45 20
 }
46 21
 </script>

+ 1
- 1
frontend/src/views/MatchesView.vue Visa fil

@@ -7,7 +7,7 @@ main.view--matches
7 7
             ProfileCardList(:pid='pid' :profiles='matches' @reload='getCards')
8 8
 
9 9
         p(v-else-if='matches.length === 0') No matches.
10
-        p(v-else) Loading...
10
+        w-spinner(v-else bounce)
11 11
 
12 12
     MainNav
13 13
 </template>

+ 1
- 1
frontend/src/views/ProfileView.vue Visa fil

@@ -8,7 +8,7 @@ main.view--profile
8 8
             :is-list='false'
9 9
             :card='card'
10 10
         )
11
-    p(v-else) Loading...
11
+    w-spinner(v-else bounce)
12 12
 
13 13
     MainNav
14 14
 </template>

Laddar…
Avbryt
Spara