|
|
@@ -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>
|