Ver código fonte

:sparkles: login vue using wave componens

tags/0.0.1^2
J 3 anos atrás
pai
commit
03a28671cc

+ 9
- 1
frontend/src/App.vue Ver arquivo

21
 import { currentProfile } from './services'
21
 import { currentProfile } from './services'
22
 import { surveyFactory } from './utils'
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
 const DEV_PID = 45
26
 const DEV_PID = 45
26
 
27
 
27
 export default {
28
 export default {
57
             if (currentProfile.isLoggedIn) {
58
             if (currentProfile.isLoggedIn) {
58
                 currentProfile.logout()
59
                 currentProfile.logout()
59
             }
60
             }
61
+
60
             await currentProfile.login(profileId, this.$waveui.notify)
62
             await currentProfile.login(profileId, this.$waveui.notify)
61
             console.log('---')
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 Ver arquivo

23
         button(@click="sendMessage") send
23
         button(@click="sendMessage") send
24
 
24
 
25
     p(v-else-if="profile.isLoggedIn && !target") No match found between profile {{ $route.params.pid }} and {{profile.id}}... 
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
     MainNav
28
     MainNav
29
 </template>
29
 </template>

+ 1
- 1
frontend/src/views/HomeView.vue Ver arquivo

5
         ProfileCardList(:pid='pid' :cards='cards' @reload='getCards')
5
         ProfileCardList(:pid='pid' :cards='cards' @reload='getCards')
6
 
6
 
7
     p(v-else-if='cards.length === 0') No profiles in match_queue.
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
     footer
10
     footer
11
         w-form
11
         w-form

+ 5
- 30
frontend/src/views/LoginView.vue Ver arquivo

1
 <template lang="pug">
1
 <template lang="pug">
2
 main.view--login
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
             //- Emit up an event so we can sync App pid with currentProfile.id
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
 </template>
11
 </template>
14
 
12
 
15
 <script>
13
 <script>
16
-import { currentProfile } from '../services'
17
-
18
 export default {
14
 export default {
19
     data: () => ({
15
     data: () => ({
20
         form: {
16
         form: {
21
             profileId: null,
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
 </script>
21
 </script>

+ 1
- 1
frontend/src/views/MatchesView.vue Ver arquivo

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

+ 1
- 1
frontend/src/views/ProfileView.vue Ver arquivo

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

Carregando…
Cancelar
Salvar