@@ -7,12 +7,7 @@ import Lockr from 'lockr';
7
7
import some from 'lodash/some' ;
8
8
import pick from 'lodash/pick' ;
9
9
import { setServerTime } from 'kolibri/utils/serverClock' ;
10
- import {
11
- UserKinds ,
12
- ERROR_CONSTANTS ,
13
- LoginErrors ,
14
- UPDATE_MODAL_DISMISSED
15
- } from 'kolibri/constants' ;
10
+ import { UserKinds , ERROR_CONSTANTS , LoginErrors , UPDATE_MODAL_DISMISSED } from 'kolibri/constants' ;
16
11
import { browser , os } from 'kolibri/utils/browserInfo' ;
17
12
18
13
// Module level state
@@ -34,25 +29,22 @@ export default function useUser() {
34
29
const currentUserId = computed ( ( ) => session . value . user_id ) ;
35
30
const isLearnerOnlyImport = computed ( ( ) => ! session . value . full_facility_import ) ;
36
31
const isCoach = computed ( ( ) =>
37
- session . value . kind . some ( kind =>
38
- [ UserKinds . COACH , UserKinds . ASSIGNABLE_COACH ] . includes ( kind )
39
- )
32
+ session . value . kind . some ( kind => [ UserKinds . COACH , UserKinds . ASSIGNABLE_COACH ] . includes ( kind ) ) ,
40
33
) ;
41
34
const isAdmin = computed ( ( ) =>
42
- session . value . kind . some ( kind =>
43
- [ UserKinds . ADMIN , UserKinds . SUPERUSER ] . includes ( kind )
44
- )
35
+ session . value . kind . some ( kind => [ UserKinds . ADMIN , UserKinds . SUPERUSER ] . includes ( kind ) ) ,
45
36
) ;
46
37
const isSuperuser = computed ( ( ) => session . value . kind . includes ( UserKinds . SUPERUSER ) ) ;
47
38
const canManageContent = computed ( ( ) =>
48
- session . value . kind . includes ( UserKinds . CAN_MANAGE_CONTENT )
39
+ session . value . kind . includes ( UserKinds . CAN_MANAGE_CONTENT ) ,
49
40
) ;
50
41
const isAppContext = computed ( ( ) => session . value . app_context ) ;
51
42
const isClassCoach = computed ( ( ) => session . value . kind . includes ( UserKinds . ASSIGNABLE_COACH ) ) ;
52
43
const isFacilityCoach = computed ( ( ) => session . value . kind . includes ( UserKinds . COACH ) ) ;
53
44
const isFacilityAdmin = computed ( ( ) => session . value . kind . includes ( UserKinds . ADMIN ) ) ;
54
- const userIsMultiFacilityAdmin = computed ( ( rootState ) =>
55
- isSuperuser . value && rootState . core . facilities . length > 1 ) ;
45
+ const userIsMultiFacilityAdmin = computed (
46
+ rootState => isSuperuser . value && rootState . core . facilities . length > 1 ,
47
+ ) ;
56
48
const getUserPermissions = computed ( ( ) => {
57
49
const permissions = { } ;
58
50
permissions . can_manage_content = canManageContent . value ;
@@ -63,7 +55,6 @@ export default function useUser() {
63
55
const getUserKind = computed ( ( ) => session . value . kind [ 0 ] ) ;
64
56
const userHasPermissions = computed ( ( ) => some ( getUserPermissions . value ) ) ;
65
57
66
-
67
58
// Actions
68
59
async function kolibriLogin ( sessionPayload ) {
69
60
Lockr . set ( UPDATE_MODAL_DISMISSED , false ) ;
@@ -126,7 +117,6 @@ export default function useUser() {
126
117
} ;
127
118
}
128
119
129
-
130
120
async function kolibrisetUnspecifiedPassword ( { username, password, facility } ) {
131
121
return client ( {
132
122
url : urls [ 'kolibri:core:setnonspecifiedpassword' ] ( ) ,
@@ -136,7 +126,6 @@ export default function useUser() {
136
126
}
137
127
138
128
return {
139
-
140
129
// Computed
141
130
isLearnerOnlyImport,
142
131
isUserLoggedIn,
0 commit comments