File tree 1 file changed +28
-18
lines changed
1 file changed +28
-18
lines changed Original file line number Diff line number Diff line change 1
- import { createPreprClient } from ' @preprio/nodejs-sdk'
1
+ import { createPreprClient } from " @preprio/nodejs-sdk" ;
2
2
3
- const PreprPlugin = { }
3
+ const PreprPlugin = {
4
+ install ( Vue , options ) {
5
+ const {
6
+ token,
7
+ timeout = 4000 ,
8
+ baseUrl = "https://cdn.prepr.io" ,
9
+ userId = null ,
10
+ } = options ;
4
11
5
- PreprPlugin . install = function ( Vue , options = { } ) {
6
- const {
7
- token,
8
- timeout = 4000 ,
9
- baseUrl = 'https://cdn.prepr.io' ,
10
- userId = null ,
11
- } = options
12
+ const version = Number ( Vue . version . split ( "." ) [ 0 ] ) ;
13
+ if ( version >= 3 ) {
14
+ Vue . config . globalProperties . $prepr = createPreprClient ( {
15
+ token,
16
+ baseUrl,
17
+ timeout,
18
+ userId,
19
+ } ) ;
20
+ } else {
21
+ Vue . prototype . $prepr = createPreprClient ( {
22
+ token,
23
+ baseUrl,
24
+ timeout,
25
+ userId,
26
+ } ) ;
27
+ }
28
+ } ,
29
+ } ;
12
30
13
- Vue . prototype . $prepr = createPreprClient ( {
14
- token,
15
- baseUrl,
16
- timeout,
17
- userId,
18
- } )
19
- }
20
-
21
- export { PreprPlugin }
31
+ export { PreprPlugin } ;
You can’t perform that action at this time.
0 commit comments