File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 98
98
"completed" : false ,
99
99
"body" : " asdf" ,
100
100
"id" : 24
101
+ },
102
+ {
103
+ "subject" : " asdf" ,
104
+ "completed" : false ,
105
+ "body" : " asdf" ,
106
+ "id" : 25
101
107
}
102
108
]
103
109
}
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ export default {
38
38
triggerToast
39
39
} = useToast ();
40
40
41
+ console .log (showToast .value );
42
+
41
43
return {
42
44
toastMessage,
43
45
toastAlertType,
Original file line number Diff line number Diff line change 1
- import { ref , onUnmounted } from 'vue' ;
1
+ import { computed , onUnmounted } from 'vue' ;
2
+ import { useStore } from 'vuex' ;
3
+
2
4
export const useToast = ( ) => {
3
- const toastMessage = ref ( '' ) ;
4
- const toastAlertType = ref ( '' ) ;
5
- const showToast = ref ( false ) ;
6
- const timeout = ref ( null ) ;
5
+ const store = useStore ( ) ;
6
+ const toastMessage = computed ( ( ) => store . state . toastMessage ) ;
7
+ const toastAlertType = computed ( ( ) => store . state . toastAlertType ) ;
8
+ const showToast = computed ( ( ) => store . state . showToast ) ;
9
+ const timeout = computed ( ( ) => store . state . timeout ) ;
7
10
const triggerToast = ( message , type = 'success' ) => {
8
11
toastMessage . value = message ;
9
12
toastAlertType . value = type ;
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import { createStore } from 'vuex';
2
2
3
3
export default createStore ( {
4
4
state : {
5
-
5
+ toastMessage : '' ,
6
+ toastAlertType : '' ,
7
+ showToast : false ,
8
+ timeout : null
6
9
}
7
10
} ) ;
You can’t perform that action at this time.
0 commit comments