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
95c81a4a
Commit
95c81a4a
authored
Nov 17, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#51
added front/tasksActions added fetchTasksByProject
parent
28da95c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
tasksTypes.js
planner-front/src/store/actionTypes/tasksTypes.js
+4
-0
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+29
-0
No files found.
planner-front/src/store/actionTypes/tasksTypes.js
View file @
95c81a4a
...
@@ -8,6 +8,10 @@ export const ADD_NEW_TASK_REQUEST = "ADD_NEW_TASK_REQUEST";
...
@@ -8,6 +8,10 @@ export const ADD_NEW_TASK_REQUEST = "ADD_NEW_TASK_REQUEST";
export
const
ADD_NEW_TASK_SUCCESS
=
"ADD_NEW_TASK_SUCCESS"
;
export
const
ADD_NEW_TASK_SUCCESS
=
"ADD_NEW_TASK_SUCCESS"
;
export
const
ADD_NEW_TASK_FAILURE
=
"ADD_NEW_TASK_FAILURE"
;
export
const
ADD_NEW_TASK_FAILURE
=
"ADD_NEW_TASK_FAILURE"
;
export
const
FETCH_TASKS_BY_PROJECT_REQUEST
=
"FETCH_TASKS_BY_PROJECT_REQUEST"
;
export
const
FETCH_TASKS_BY_PROJECT_SUCCESS
=
"FETCH_TASKS_BY_PROJECT_SUCCESS"
;
export
const
FETCH_TASKS_BY_PROJECT_FAILURE
=
"FETCH_TASKS_BY_PROJECT_FAILURE"
;
export
const
EDIT_TASK_REQUEST
=
"EDIT_TASK_REQUEST"
;
export
const
EDIT_TASK_REQUEST
=
"EDIT_TASK_REQUEST"
;
export
const
EDIT_TASK_SUCCESS
=
"EDIT_TASK_SUCCESS"
;
export
const
EDIT_TASK_SUCCESS
=
"EDIT_TASK_SUCCESS"
;
export
const
EDIT_TASK_FAILURE
=
"EDIT_TASK_FAILURE"
;
export
const
EDIT_TASK_FAILURE
=
"EDIT_TASK_FAILURE"
;
...
...
planner-front/src/store/actions/tasksActions.js
View file @
95c81a4a
...
@@ -12,6 +12,9 @@ import {
...
@@ -12,6 +12,9 @@ import {
FETCH_CALENDAR_TASKS_REQUEST
,
FETCH_CALENDAR_TASKS_REQUEST
,
FETCH_CALENDAR_TASKS_SUCCESS
,
FETCH_CALENDAR_TASKS_SUCCESS
,
FETCH_ALL_TASKS_SUCCESS
,
FETCH_ALL_TASKS_SUCCESS
,
FETCH_TASKS_BY_PROJECT_SUCCESS
,
FETCH_TASKS_BY_PROJECT_FAILURE
,
FETCH_TASKS_BY_PROJECT_REQUEST
}
from
"../actionTypes/tasksTypes"
;
}
from
"../actionTypes/tasksTypes"
;
import
axios
from
'../../axiosPlanner'
import
axios
from
'../../axiosPlanner'
...
@@ -134,4 +137,30 @@ export const deleteTask = (taskId) => {
...
@@ -134,4 +137,30 @@ export const deleteTask = (taskId) => {
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
const
fetchTasksByProjectRequest
=
()
=>
{
return
{
type
:
FETCH_TASKS_BY_PROJECT_REQUEST
}
};
const
fetchTasksByProjectSuccess
=
()
=>
{
return
{
type
:
FETCH_TASKS_BY_PROJECT_SUCCESS
}
};
const
fetchTasksByProjectFailure
=
(
error
)
=>
{
return
{
type
:
FETCH_TASKS_BY_PROJECT_FAILURE
,
error
}
};
export
const
fetchTasksByProject
=
(
projects
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchTasksByProjectRequest
());
try
{
await
axios
.
post
(
"/tasks/project"
,
projects
);
dispatch
(
addTaskSuccess
())
dispatch
(
fetchTasksByProjectSuccess
(
response
.
data
.
tasks
))
}
catch
(
error
)
{
dispatch
(
fetchTasksByProjectFailure
(
error
.
response
.
data
));
}
}
}
}
\ No newline at end of file
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