@@ -11,6 +11,7 @@ import {
11
11
UNLOAD_PROJECTS_SUCCESS ,
12
12
PROJECTS_PAGE_SIZE
13
13
} from '../config/constants'
14
+ import { checkAdmin } from '../util/tc'
14
15
import _ from 'lodash'
15
16
16
17
/**
@@ -29,7 +30,7 @@ export function setActiveProject (projectId) {
29
30
/**
30
31
* Loads projects of the authenticated user
31
32
*/
32
- export function loadProjects ( filterProjectName = '' , myProjects = true , paramFilters = { } ) {
33
+ export function loadProjects ( filterProjectName = '' , paramFilters = { } ) {
33
34
return ( dispatch , getState ) => {
34
35
dispatch ( {
35
36
type : LOAD_PROJECTS_PENDING
@@ -48,18 +49,18 @@ export function loadProjects (filterProjectName = '', myProjects = true, paramFi
48
49
}
49
50
}
50
51
51
- if ( myProjects ) {
52
+ if ( ! checkAdmin ( getState ( ) . auth . token ) ) {
52
53
filters [ 'memberOnly' ] = true
53
54
}
54
55
56
+ // eslint-disable-next-line no-debugger
55
57
const state = getState ( ) . sidebar
56
- // eslint-disable-next-line no-sequences
57
- fetchMemberProjects ( filters ) . then ( ( { projects, pagination } ) => ( console . log ( 'here' , pagination ) , dispatch ( {
58
+ fetchMemberProjects ( filters ) . then ( ( { projects, pagination } ) => dispatch ( {
58
59
type : LOAD_PROJECTS_SUCCESS ,
59
60
projects : _ . uniqBy ( ( state . projects || [ ] ) . concat ( projects ) , 'id' ) ,
60
61
total : pagination . xTotal ,
61
62
page : pagination . xPage
62
- } ) ) ) . catch ( ( ) => dispatch ( {
63
+ } ) ) . catch ( ( ) => dispatch ( {
63
64
type : LOAD_PROJECTS_FAILURE
64
65
} ) )
65
66
}
@@ -68,19 +69,19 @@ export function loadProjects (filterProjectName = '', myProjects = true, paramFi
68
69
/**
69
70
* Load more projects for the authenticated user
70
71
*/
71
- export function loadMoreProjects ( filterProjectName = '' , myProjects = true , paramFilters = { } ) {
72
+ export function loadMoreProjects ( filterProjectName = '' , paramFilters = { } ) {
72
73
return ( dispatch , getState ) => {
73
74
const state = getState ( ) . sidebar
74
75
75
- loadProjects ( filterProjectName , myProjects , _ . assignIn ( { } , paramFilters , {
76
+ loadProjects ( filterProjectName , _ . assignIn ( { } , paramFilters , {
76
77
perPage : PROJECTS_PAGE_SIZE ,
77
78
page : state . page + 1
78
79
} ) ) ( dispatch , getState )
79
80
}
80
81
}
81
82
82
- export function loadTaasProjects ( filterProjectName = '' , myProjects = true , paramFilters = { } ) {
83
- return loadProjects ( filterProjectName , myProjects , Object . assign ( {
83
+ export function loadTaasProjects ( filterProjectName = '' , paramFilters = { } ) {
84
+ return loadProjects ( filterProjectName , Object . assign ( {
84
85
type : 'talent-as-a-service'
85
86
} , paramFilters ) )
86
87
}
0 commit comments