Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kszkepzes-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
kszkepzes
old
kszkepzes-frontend
Commits
a894f3c8
Commit
a894f3c8
authored
6 years ago
by
Chif Gergő
Browse files
Options
Downloads
Patches
Plain Diff
Create actions to create notes for events, move note actions to notes.js
parent
7289a63c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/actions/notes.js
+43
-0
43 additions, 0 deletions
src/actions/notes.js
src/actions/statistics.js
+0
-14
0 additions, 14 deletions
src/actions/statistics.js
src/actions/types.js
+4
-0
4 additions, 0 deletions
src/actions/types.js
with
47 additions
and
14 deletions
src/actions/notes.js
0 → 100644
+
43
−
0
View file @
a894f3c8
import
axios
from
'
./session
'
;
import
{
GET_NOTES_BY_EVENT
,
WRITE_NOTE
,
ADD_NOTE
,
}
from
'
./types
'
;
export
const
getNotesByEvent
=
id
=>
(
async
(
dispatch
)
=>
{
try
{
const
response
=
await
axios
.
get
(
'
/api/v1/notes/
'
,
{
params
:
{
eventID
:
id
}
});
dispatch
({
type
:
GET_NOTES_BY_EVENT
,
payload
:
response
.
data
,
});
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
);
export
const
writeNote
=
(
event
)
=>
{
return
(
dispatch
=>
(
dispatch
({
type
:
WRITE_NOTE
,
payload
:
event
.
target
.
value
})));
};
export
const
postEventNote
=
({
eventid
,
userid
,
note
})
=>
(
async
(
dispatch
)
=>
{
try
{
const
response
=
await
axios
.
post
(
'
/api/v1/note/
'
,
{
event
:
eventid
?
eventid
:
''
,
user
:
userid
?
eventid
:
''
,
note
,
});
if
(
response
.
data
.
id
)
{
alert
(
'
Sikeres mentés!
'
);
dispatch
({
type
:
ADD_EVENT_NOTE
,
payload
:
response
.
data
,
});
}
catch
(
e
)
{
console
.
log
(
e
);
}
});
This diff is collapsed.
Click to expand it.
src/actions/statistics.js
+
0
−
14
View file @
a894f3c8
...
...
@@ -71,20 +71,6 @@ export const visitorChange = ({ id }) => {
return
(
dispatch
=>
(
dispatch
({
type
:
VISITOR_CHANGE
,
payload
:
id
})));
};
export
const
getNotesByEvent
=
id
=>
(
async
(
dispatch
)
=>
{
try
{
const
response
=
await
axios
.
get
(
'
/api/v1/notes/
'
,
{
params
:
{
eventID
:
id
}
});
dispatch
({
type
:
GET_NOTES_BY_EVENT
,
payload
:
response
.
data
,
});
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
);
export
const
submitVisitors
=
({
id
,
visitors
})
=>
(
async
()
=>
{
try
{
...
...
This diff is collapsed.
Click to expand it.
src/actions/types.js
+
4
−
0
View file @
a894f3c8
...
...
@@ -22,3 +22,7 @@ export const GET_NOTES_BY_EVENT = 'get_notes_by_event';
export
const
WRITE_EVENT
=
'
write_event
'
;
export
const
ADD_EVENT
=
'
add_event
'
;
export
const
DELETE_EVENT
=
'
delete_event
'
;
export
const
WRITE_NOTE
=
'
write_note
'
;
export
const
CLEAR_NOTE
=
'
clear_note
'
;
export
const
ADD_EVENT_NOTE
=
'
add_note
'
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment