Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
637da7d0
Commit
637da7d0
authored
Feb 22, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#167
transfer all redux relatted operations for fetch_projects_non_watcher to the projects redux
parent
93761de7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
35 deletions
+55
-35
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+2
-1
projectsActionTypes.js
planner-front/src/store/actionTypes/projectsActionTypes.js
+7
-1
tasksTypes.js
planner-front/src/store/actionTypes/tasksTypes.js
+0
-5
projectsActions.js
planner-front/src/store/actions/projectsActions.js
+20
-0
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+0
-18
projectsReducer.js
planner-front/src/store/reducers/projectsReducer.js
+24
-1
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+2
-9
No files found.
planner-front/src/containers/MyTasks/MyTasks.js
View file @
637da7d0
...
...
@@ -5,7 +5,7 @@ import MyTasksTableContainer from '../../components/MyTasksCompoments/MyTasksTab
import
{
activateCreateCopyTasksMode
,
fetchAllTasks
,
sortTaskByProjects
,
addTask
,
deleteTask
,
deleteDateTimeTask
,
editTask
}
from
'../../store/actions/tasksActions'
;
import
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useCallback
,
useEffect
,
useState
}
from
'react'
;
import
{
fetchAllUserProjects
,
fetchProjects
}
from
'../../store/actions/projectsActions'
;
import
{
fetchAllUserProjects
,
fetchProjects
,
fetchProjectsNonWatcherForTaskCreate
}
from
'../../store/actions/projectsActions'
;
import
moment
from
'moment'
;
import
{
useNavigate
}
from
'react-router-dom'
;
...
...
@@ -118,6 +118,7 @@ export default function MyTasks() {
dateTimeDeadLine
:
null
})
}
dispatch
(
fetchProjectsNonWatcherForTaskCreate
(
user
.
id
))
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
},
[
addFormStatus
])
...
...
planner-front/src/store/actionTypes/projectsActionTypes.js
View file @
637da7d0
...
...
@@ -19,4 +19,10 @@ export const DELETE_PROJECT_FAILURE = "DELETE_PROJECT_FAILURE";
export
const
CHANGE_MEMBER_ROLE_REQUEST
=
"CHANGE_MEMBER_ROLE_REQUEST"
;
export
const
CHANGE_MEMBER_ROLE_SUCCESS
=
"CHANGE_MEMBER_ROLE_SUCCESS"
;
export
const
CHANGE_MEMBER_ROLE_FAILURE
=
"CHANGE_MEMBER_ROLE_FAILURE"
;
\ No newline at end of file
export
const
CHANGE_MEMBER_ROLE_FAILURE
=
"CHANGE_MEMBER_ROLE_FAILURE"
;
export
const
FETCH_PROJECTS_NON_WATCHER_REQUEST
=
"FETCH_PROJECTS_NON_WATCHER_REQUEST"
;
export
const
FETCH_PROJECTS_NON_WATCHER_SUCCESS
=
"FETCH_PROJECTS_NON_WATCHER_SUCCESS"
;
export
const
FETCH_PROJECTS_NON_WATCHER_FAILURE
=
"FETCH_PROJECTS_NON_WATCHER_FAILURE"
;
planner-front/src/store/actionTypes/tasksTypes.js
View file @
637da7d0
...
...
@@ -34,11 +34,6 @@ export const ACTIVATE_CREATE_COPY_TASKS_MODE = "ACTIVATE_CREATE_COPY_TASKS_MODE"
export
const
DEACTIVATE_CREATE_COPY_TASKS_MODE
=
"DEACTIVATE_CREATE_COPY_TASKS_MODE"
export
const
FETCH_PROJECTS_NON_WATCHER_REQUEST
=
"FETCH_PROJECTS_NON_WATCHER_REQUEST"
;
export
const
FETCH_PROJECTS_NON_WATCHER_SUCCESS
=
"FETCH_PROJECTS_NON_WATCHER_SUCCESS"
;
export
const
FETCH_PROJECTS_NON_WATCHER_FAILURE
=
"FETCH_PROJECTS_NON_WATCHER_FAILURE"
;
...
...
planner-front/src/store/actions/projectsActions.js
View file @
637da7d0
...
...
@@ -164,3 +164,23 @@ export const changeMemberRole = (userId, data) => {
}
}
const
fetchProjectsNonWatcherSuccess
=
(
projects
)
=>
{
return
{
type
:
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
projects
}
};
const
fetchProjectsNonWatcherFailure
=
(
error
)
=>
{
return
{
type
:
FETCH_PROJECTS_NON_WATCHER_FAILURE
,
error
}
};
export
const
fetchProjectsNonWatcherForTaskCreate
=
(
userId
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchCalendarTasksRequest
());
try
{
const
response
=
await
axios
.
get
(
`/projects/task_create/
${
userId
}
`
);
dispatch
(
fetchProjectsNonWatcherSuccess
(
response
.
data
.
projects
))
}
catch
(
error
)
{
dispatch
(
fetchProjectsNonWatcherFailure
(
error
.
response
.
data
));
}
}
};
\ No newline at end of file
planner-front/src/store/actions/tasksActions.js
View file @
637da7d0
...
...
@@ -55,25 +55,7 @@ export const fetchCalendarTasks = (userId) => {
}
}
};
const
fetchProjectsNonWatcherSuccess
=
(
projects
)
=>
{
return
{
type
:
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
projects
}
};
const
fetchProjectsNonWatcherFailure
=
(
error
)
=>
{
return
{
type
:
FETCH_PROJECTS_NON_WATCHER_FAILURE
,
error
}
};
export
const
fetchProjectsForTaskCreate
=
(
userId
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchCalendarTasksRequest
());
try
{
const
response
=
await
axios
.
get
(
`/projects/task_create/
${
userId
}
`
);
dispatch
(
fetchProjectsNonWatcherSuccess
(
response
.
data
.
projects
))
}
catch
(
error
)
{
dispatch
(
fetchProjectsNonWatcherFailure
(
error
.
response
.
data
));
}
}
};
export
const
fetchAllTasks
=
()
=>
{
return
async
(
dispatch
)
=>
{
...
...
planner-front/src/store/reducers/projectsReducer.js
View file @
637da7d0
import
{
CHANGE_MEMBER_ROLE_FAILURE
,
CHANGE_MEMBER_ROLE_REQUEST
,
CHANGE_MEMBER_ROLE_SUCCESS
,
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
}
from
"../actionTypes/projectsActionTypes"
;
import
{
CHANGE_MEMBER_ROLE_FAILURE
,
CHANGE_MEMBER_ROLE_REQUEST
,
CHANGE_MEMBER_ROLE_SUCCESS
,
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_REQUEST
,
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_FAILURE
}
from
"../actionTypes/projectsActionTypes"
;
const
initialState
=
{
allUserProjectsForModalTask
:
[],
...
...
@@ -42,6 +59,12 @@ const projectsReducer = (state = initialState, action) => {
return
{
...
state
,
loading
:
true
};
case
CHANGE_MEMBER_ROLE_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
FETCH_PROJECTS_NON_WATCHER_REQUEST
:
return
{
...
state
,
loading
:
true
};
case
FETCH_PROJECTS_NON_WATCHER_SUCCESS
:
return
{
...
state
,
loading
:
false
,
allUserProjectsForModalTask
:
action
.
projects
};
case
FETCH_PROJECTS_NON_WATCHER_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
default
:
return
state
;
}
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
637da7d0
...
...
@@ -23,9 +23,7 @@ import {
ACTIVATE_CREATE_COPY_TASKS_MODE
,
DEACTIVATE_CREATE_COPY_TASKS_MODE
,
SORT_TASKS
,
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_REQUEST
,
FETCH_PROJECTS_NON_WATCHER_FAILURE
,
}
from
"../actionTypes/tasksTypes"
;
const
initialState
=
{
...
...
@@ -171,12 +169,7 @@ const tasksReduсer = (state = initialState, action) => {
}
}
return
{
...
state
,
loading
:
false
,
sortedTasks
:
filteredTasks
};
case
FETCH_PROJECTS_NON_WATCHER_REQUEST
:
return
{
...
state
,
loading
:
true
};
case
FETCH_PROJECTS_NON_WATCHER_SUCCESS
:
return
{
...
state
,
loading
:
false
,
projectsNonWatcher
:
action
.
projects
};
case
FETCH_PROJECTS_NON_WATCHER_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
default
:
return
state
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment