@@ -39,6 +39,7 @@ export const additionalActionTypes = {
3939 ...createActionsWithPostfixes ( 'LOCK_STUDENT_EXAM' , 'recodex/groups' ) ,
4040 ...createActionsWithPostfixes ( 'UNLOCK_STUDENT_EXAM' , 'recodex/groups' ) ,
4141 ...createActionsWithPostfixes ( 'RELOCATE' , 'recodex/groups' ) ,
42+ ...createActionsWithPostfixes ( 'GET_ATTRIBUTES' , 'recodex/groups' ) ,
4243} ;
4344
4445export const loadGroup = actions . pushResource ;
@@ -164,6 +165,14 @@ export const relocateGroup = (groupId, newParentId) =>
164165 endpoint : `/groups/${ groupId } /relocate/${ newParentId } ` ,
165166 } ) ;
166167
168+ export const getGroupAttributes = groupId =>
169+ createApiAction ( {
170+ type : additionalActionTypes . GET_ATTRIBUTES ,
171+ method : 'GET' ,
172+ endpoint : `/group-attributes/${ groupId } ` ,
173+ meta : { groupId } ,
174+ } ) ;
175+
167176/*
168177 * Exam-related stuff
169178 */
@@ -323,6 +332,15 @@ const reducer = handleActions(
323332 state
324333 ) ,
325334
335+ [ additionalActionTypes . GET_ATTRIBUTES_PENDING ] : ( state , { meta : { groupId } } ) =>
336+ state . setIn ( [ 'attributes' , groupId ] , createRecord ( ) ) ,
337+
338+ [ additionalActionTypes . GET_ATTRIBUTES_FULFILLED ] : ( state , { meta : { groupId } , payload : data } ) =>
339+ state . setIn ( [ 'attributes' , groupId ] , createRecord ( { state : resourceStatus . FULFILLED , data } ) ) ,
340+
341+ [ additionalActionTypes . GET_ATTRIBUTES_REJECTED ] : ( state , { meta : { groupId } , payload : error } ) =>
342+ state . setIn ( [ 'attributes' , groupId ] , createRecord ( { state : resourceStatus . FAILED , error } ) ) ,
343+
326344 [ additionalActionTypes . SET_EXAM_FLAG_PENDING ] : ( state , { meta : { groupId } } ) =>
327345 state . setIn ( [ 'resources' , groupId , 'pending-group-type' ] , true ) ,
328346
0 commit comments