@data-fair/lib-vue 1.18.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/async-action.js +2 -3
- package/package.json +2 -2
- package/session.d.ts +2 -0
- package/session.js +9 -0
package/async-action.js
CHANGED
|
@@ -23,6 +23,7 @@ export function useAsyncAction (fn, options) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
loading.value = false
|
|
26
|
+
if (options?.finally) { await options?.finally() }
|
|
26
27
|
return result
|
|
27
28
|
} catch (err) {
|
|
28
29
|
error.value = getErrorMsg(err)
|
|
@@ -32,9 +33,7 @@ export function useAsyncAction (fn, options) {
|
|
|
32
33
|
sendUiNotif(errorNotif)
|
|
33
34
|
}
|
|
34
35
|
loading.value = false
|
|
35
|
-
|
|
36
|
-
if (options?.finally) {
|
|
37
|
-
await options?.finally()
|
|
36
|
+
if (options?.finally) { await options?.finally() }
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
return { execute, notif: shallowReadonly(notif), loading: readonly(loading), error: readonly(error) }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-fair/lib-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "Composables and other utilities for Vue applications in the data-fair stack.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@data-fair/lib-common-types": "^1.
|
|
31
|
+
"@data-fair/lib-common-types": "^1.7.1",
|
|
32
32
|
"@data-fair/lib-utils": "^1.0.0",
|
|
33
33
|
"jwt-decode": "^4.0.0",
|
|
34
34
|
"universal-cookie": "^7.2.0"
|
package/session.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export interface Session {
|
|
|
68
68
|
organization: ComputedRef<SessionState['organization']>;
|
|
69
69
|
account: ComputedRef<SessionState['account']>;
|
|
70
70
|
accountRole: ComputedRef<SessionState['accountRole']>;
|
|
71
|
+
siteRole: ComputedRef<SessionState['siteRole']>;
|
|
71
72
|
lang: ComputedRef<SessionState['lang']>;
|
|
72
73
|
theme: Ref<null | Theme>;
|
|
73
74
|
site: Ref<SiteInfo | null>;
|
|
@@ -101,6 +102,7 @@ export declare function createSession(initOptions: Partial<SessionOptions>): Pro
|
|
|
101
102
|
organization: ComputedRef<SessionState["organization"]>;
|
|
102
103
|
account: ComputedRef<SessionState["account"]>;
|
|
103
104
|
accountRole: ComputedRef<SessionState["accountRole"]>;
|
|
105
|
+
siteRole: ComputedRef<SessionState["siteRole"]>;
|
|
104
106
|
lang: ComputedRef<SessionState["lang"]>;
|
|
105
107
|
theme: Ref<null | Theme>;
|
|
106
108
|
site: Ref<SiteInfo | null>;
|
package/session.js
CHANGED
|
@@ -121,6 +121,14 @@ export async function getSession (initOptions) {
|
|
|
121
121
|
}
|
|
122
122
|
state.accountRole = 'admin'
|
|
123
123
|
}
|
|
124
|
+
if (state.user?.siteOwner) {
|
|
125
|
+
if (state.user.siteOwner.type === 'user' && state.user.siteOwner.id === state.user.id) {
|
|
126
|
+
state.siteRole = 'admin'
|
|
127
|
+
}
|
|
128
|
+
if (state.user.siteOwner.type === 'organization' && state.user.siteOwner.id === state.organization?.id) {
|
|
129
|
+
state.siteRole = state.organization.role
|
|
130
|
+
}
|
|
131
|
+
}
|
|
124
132
|
}
|
|
125
133
|
readState()
|
|
126
134
|
debug('initial state', state)
|
|
@@ -283,6 +291,7 @@ export async function getSession (initOptions) {
|
|
|
283
291
|
user: computed(() => state.user),
|
|
284
292
|
account: computed(() => state.account),
|
|
285
293
|
accountRole: computed(() => state.accountRole),
|
|
294
|
+
siteRole: computed(() => state.siteRole),
|
|
286
295
|
lang: computed(() => state.lang),
|
|
287
296
|
theme: readonly(theme),
|
|
288
297
|
site: shallowReadonly(site),
|