File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -166,12 +166,6 @@ export default {
166
166
167
167
async applyDarkMode (enabled ) {
168
168
localStorage .setItem (' vue-ui-dark-mode' , enabled .toString ())
169
- const el = document .getElementsByTagName (' html' )[0 ]
170
- if (enabled) {
171
- el .classList .add (' vue-ui-dark-mode' )
172
- } else {
173
- el .classList .remove (' vue-ui-dark-mode' )
174
- }
175
169
await this .$apollo .mutate ({
176
170
mutation: DARK_MODE_SET ,
177
171
variables: {
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ export default {
22
22
darkMode : enabled
23
23
}
24
24
cache . writeData ( { data } )
25
+ const el = document . getElementsByTagName ( 'html' ) [ 0 ]
26
+ if ( enabled ) {
27
+ el . classList . add ( 'vue-ui-dark-mode' )
28
+ } else {
29
+ el . classList . remove ( 'vue-ui-dark-mode' )
30
+ }
25
31
return null
26
32
}
27
33
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import clientStateResolvers from './state/resolvers'
7
7
// import CONNECTED from './graphql/connected.gql'
8
8
import CONNECTED_SET from './graphql/connectedSet.gql'
9
9
import LOADING_CHANGE from './graphql/loadingChange.gql'
10
+ import DARK_MODE_SET from './graphql/darkModeSet.gql'
10
11
11
12
// Install the vue plugin
12
13
Vue . use ( VueApollo )
@@ -67,6 +68,13 @@ export async function resetApollo () {
67
68
} catch ( e ) {
68
69
// Potential errors
69
70
}
71
+ const raw = localStorage . getItem ( 'vue-ui-dark-mode' )
72
+ apolloClient . mutate ( {
73
+ mutation : DARK_MODE_SET ,
74
+ variables : {
75
+ enabled : raw === 'true'
76
+ }
77
+ } )
70
78
}
71
79
72
80
/* Connected state */
You can’t perform that action at this time.
0 commit comments