Skip to content

Commit 8dffeb0

Browse files
author
Guillaume Chau
committed
Dist
1 parent 8bbb5d6 commit 8dffeb0

File tree

3 files changed

+37
-19
lines changed

3 files changed

+37
-19
lines changed

dist/vue-apollo.esm.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,21 +3292,30 @@ var ApolloProvider$1 = function () {
32923292
});
32933293
}
32943294
}, {
3295-
key: 'exportStates',
3296-
value: function exportStates(options) {
3295+
key: 'getStates',
3296+
value: function getStates(options) {
32973297
var finalOptions = Object.assign({}, {
3298-
exportNamespace: '',
3299-
globalName: '__APOLLO_STATE__',
3300-
attachTo: 'window'
3298+
exportNamespace: ''
33013299
}, options);
3302-
3303-
var js = finalOptions.attachTo + '.' + finalOptions.globalName + ' = {';
3300+
var states = {};
33043301
for (var key in this.clients) {
33053302
var client = this.clients[key];
33063303
var state = defineProperty({}, client.reduxRootKey || 'apollo', client.getInitialState());
3307-
js += '[\'' + finalOptions.exportNamespace + key + '\']:' + JSON.stringify(state) + ',';
3304+
states['' + finalOptions.exportNamespace + key] = state;
33083305
}
3309-
js += '};';
3306+
return states;
3307+
}
3308+
}, {
3309+
key: 'exportStates',
3310+
value: function exportStates(options) {
3311+
var finalOptions = Object.assign({}, {
3312+
globalName: '__APOLLO_STATE__',
3313+
attachTo: 'window'
3314+
}, options);
3315+
var states = this.getStates({
3316+
exportNamespace: options.exportNamespace
3317+
});
3318+
var js = finalOptions.attachTo + '.' + finalOptions.globalName + ' = ' + JSON.stringify(states) + ';';
33103319
return js;
33113320
}
33123321
}]);

0 commit comments

Comments
 (0)