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
93761de7
Commit
93761de7
authored
Feb 22, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#167
added types , actions , cases to reducers for the redux on fetch_projects_non_watcher
parent
df273c50
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
2 deletions
+44
-2
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+2
-0
tasksTypes.js
planner-front/src/store/actionTypes/tasksTypes.js
+10
-0
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+22
-1
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+10
-1
No files found.
planner-front/src/containers/MyTasks/MyTasks.js
View file @
93761de7
...
...
@@ -121,6 +121,8 @@ export default function MyTasks() {
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
},
[
addFormStatus
])
const
createNewTaskHandler
=
useCallback
(()
=>
{
const
task
=
{
...
newTask
,
...
...
planner-front/src/store/actionTypes/tasksTypes.js
View file @
93761de7
...
...
@@ -33,4 +33,14 @@ export const FETCH_ALL_TASKS_BY_MEMBERSHIP_FAILURE = "FETCH_ALL_TASKS_BY_MEMBERS
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"
;
export
const
SORT_TASKS
=
"SORT_TASKS"
\ No newline at end of file
planner-front/src/store/actions/tasksActions.js
View file @
93761de7
...
...
@@ -21,7 +21,9 @@ import {
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
DEACTIVATE_CREATE_COPY_TASKS_MODE
,
ACTIVATE_CREATE_COPY_TASKS_MODE
,
SORT_TASKS
SORT_TASKS
,
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_FAILURE
,
}
from
"../actionTypes/tasksTypes"
;
import
axios
from
'../../axiosPlanner'
...
...
@@ -53,6 +55,25 @@ 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/tasksReducer.js
View file @
93761de7
...
...
@@ -22,7 +22,10 @@ import {
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
ACTIVATE_CREATE_COPY_TASKS_MODE
,
DEACTIVATE_CREATE_COPY_TASKS_MODE
,
SORT_TASKS
SORT_TASKS
,
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_REQUEST
,
FETCH_PROJECTS_NON_WATCHER_FAILURE
,
}
from
"../actionTypes/tasksTypes"
;
const
initialState
=
{
...
...
@@ -168,6 +171,12 @@ 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