-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
35 lines (29 loc) · 952 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import mixin from './src/mixin'
import store from './src/store'
export default {
install: function(Vue, options = {}) {
options = {
domain: null,
token: null,
store: null,
wordpress: false,
...options
}
// basic usage warning
if (!options.domain || !options.token || !options.store) {
console.error(
'You need to set the Shopify domain, Shopify token, and Vuex store for wp-shopify to work correctly. No action taken.'
)
return
}
// make shopify info accessible anywhere
Vue.prototype.$shopify = options
// set starting domain and token
// add module to store
store.state.domain = options.domain
store.state.token = options.token
options.store.registerModule('shopify', store)
// define mixin
Vue.mixin(mixin)
}
}