File tree 3 files changed +73
-46
lines changed
3 files changed +73
-46
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<ion-app >
3
3
<ion-split-pane content-id =" main" >
4
- <ion-menu content-id =" main" v-if =" $store.state.user" >
5
- <ion-header >
6
- <ion-toolbar color =" primary" >
7
- <ion-title >Menu</ion-title >
8
- </ion-toolbar >
9
- </ion-header >
10
-
11
- <ion-content >
12
- <ion-list >
13
- <ion-list-header >Navigate</ion-list-header >
14
- <ion-menu-toggle auto-hide =" false" >
15
- <ion-item button @click =" $router.push('/')" >
16
- <ion-icon name =" home" ></ion-icon >
17
- <ion-label >
18
- <span :class =" [{boldLabel : isActive('/') }, 'menu-label']" >Home</span >
19
- </ion-label >
20
- </ion-item >
21
- </ion-menu-toggle >
22
- <ion-menu-toggle auto-hide =" false" >
23
- <ion-item button @click =" $router.push('/about')" >
24
- <ion-icon name =" help" ></ion-icon >
25
- <ion-label >
26
- <span :class =" [{boldLabel : isActive('/about') }, 'menu-label']" >About</span >
27
- </ion-label >
28
- </ion-item >
29
- </ion-menu-toggle >
30
- </ion-list >
31
- </ion-content >
32
- <ion-footer style =" text-align :center " class =" ion-padding" >
33
- <ion-button @click =" logout()" >LOGOUT</ion-button >
34
- </ion-footer >
35
- </ion-menu >
36
-
4
+ <Menu />
37
5
<ion-vue-router id =" main" ></ion-vue-router >
38
6
</ion-split-pane >
39
7
</ion-app >
40
8
</template >
41
9
42
10
<script >
43
- import store from " ./store" ;
44
-
11
+ import Menu from " ./components/Menu" ;
45
12
export default {
46
13
name: " App" ,
47
- components: {},
14
+ components: {
15
+ Menu
16
+ },
48
17
computed: {},
49
- methods: {
50
- isActive (_path ) {
51
- return this .$route .path == _path;
52
- },
53
- async logout () {
54
- await store .dispatch (" user/logout" );
55
- this .$router .replace (" /login" );
56
- }
57
- }
18
+ methods: {}
58
19
};
59
20
</script >
60
21
<style scoped>
Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-debugger */
2
+ <template >
3
+ <ion-menu content-id =" main" side =" start" id =" main-menu" v-if =" $store.state.user.user" >
4
+ <ion-header >
5
+ <ion-toolbar color =" primary" >
6
+ <ion-title >Menu</ion-title >
7
+ </ion-toolbar >
8
+ </ion-header >
9
+
10
+ <ion-content >
11
+ <ion-list >
12
+ <ion-list-header >
13
+ <h2 >{{$store.state.user.user.email}}</h2 >
14
+ </ion-list-header >
15
+ <ion-menu-toggle auto-hide =" false" >
16
+ <ion-item button @click =" $router.push('/')" >
17
+ <ion-icon name =" home" ></ion-icon >
18
+ <ion-label >
19
+ <span :class =" [{boldLabel : isActive('/') }, 'menu-label']" >Home</span >
20
+ </ion-label >
21
+ </ion-item >
22
+ </ion-menu-toggle >
23
+ <ion-menu-toggle auto-hide =" false" >
24
+ <ion-item button @click =" $router.push('/about')" >
25
+ <ion-icon name =" help" ></ion-icon >
26
+ <ion-label >
27
+ <span :class =" [{boldLabel : isActive('/about') }, 'menu-label']" >About</span >
28
+ </ion-label >
29
+ </ion-item >
30
+ </ion-menu-toggle >
31
+ </ion-list >
32
+ </ion-content >
33
+ <ion-footer style =" text-align :center " class =" ion-padding" >
34
+ <ion-button @click =" logout()" >LOGOUT</ion-button >
35
+ </ion-footer >
36
+ </ion-menu >
37
+ </template >
38
+
39
+ <script >
40
+ import store from " ../store" ;
41
+ export default {
42
+ name: " Menu" ,
43
+ components: {},
44
+ computed: {},
45
+ methods: {
46
+ isActive (_path ) {
47
+ return this .$route .path == _path;
48
+ },
49
+ async logout () {
50
+ let menuController = document .querySelector (" #main-menu" );
51
+ await menuController .close (true );
52
+ await store .dispatch (" user/logout" );
53
+ this .$router .replace (" /login" );
54
+ }
55
+ }
56
+ };
57
+ </script >
58
+
59
+ <style scoped>
60
+ .menu-label {
61
+ padding-left : 0.5em !important ;
62
+ }
63
+ .boldLabel {
64
+ font-weight : bold ;
65
+ }
66
+ </style >
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export default {
22
22
} ) ;
23
23
} ,
24
24
login ( { commit } , payload ) {
25
- if ( payload . email == "[email protected] " ) {
25
+ if ( payload . email ! == "" ) {
26
26
commit ( "hasUser" , { ...payload } ) ;
27
27
return true ;
28
28
} else {
You can’t perform that action at this time.
0 commit comments