-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (32 loc) · 1.08 KB
/
index.js
File metadata and controls
40 lines (32 loc) · 1.08 KB
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
36
37
38
39
40
import { useGirderClient, useNotificationBus } from '@/composables';
import components from './components';
import vuetify from './vuetify';
/**
* @typedef {Object} GwcPluginOptions
* @property {Object} [girder] - Configuration for the Girder Rest Client
* @property {Object} [notifications] - Configuration for the Girder Notification Bus
* @property {Boolean} [components] - Register all components
* @property {Object} [vuetifyConfig] - Custom vuetify config
*/
/**
* @param {import('vue').App} app
* @param {GwcPluginOptions} [options={}]
*/
export default function install(app, options = {}) {
const girder = useGirderClient(options.girder || {});
if (!!girder.apiRoot.value) {
girder.rest.fetchUser();
}
if (options.notifications){
const notification = useNotificationBus(girder.rest, options.notifications);
if (girder.user.value) {
notification.bus.connect();
}
app.provide('notifications', notification);
}
app.provide('girder', girder);
app.use(vuetify, options.vuetifyConfig || {});
if (options.components){
app.use(components);
}
}