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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Köpeczi-Bócz Gergely
kszkepzes-frontend
Commits
eab21544
Commit
eab21544
authored
6 years ago
by
Sandor Bereczki
Browse files
Options
Downloads
Patches
Plain Diff
Added ClearWrite action, solution fix
parent
cee7815d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/actions/homework.js
+0
-5
0 additions, 5 deletions
src/actions/homework.js
src/components/forms/AddSolutionForm.js
+5
-4
5 additions, 4 deletions
src/components/forms/AddSolutionForm.js
src/reducers/AddSolutionReducer.js
+3
-1
3 additions, 1 deletion
src/reducers/AddSolutionReducer.js
with
8 additions
and
10 deletions
src/actions/homework.js
+
0
−
5
View file @
eab21544
...
...
@@ -77,8 +77,6 @@ export const addSolution = ({
type
:
ADD_SOLUTION
,
payload
:
response
.
data
,
});
}
else
{
alert
(
'
Mentés nem sikerült!
'
);
}
}
catch
(
e
)
{
console
.
log
(
e
);
...
...
@@ -103,13 +101,10 @@ export const addDocument = ({
};
const
response
=
await
axios
.
post
(
'
/api/v1/documents/
'
,
formData
,
config
);
if
(
response
.
data
.
id
)
{
alert
(
'
Sikeres mentés!
'
);
dispatch
({
type
:
ADD_DOCUMENT
,
payload
:
response
.
data
,
});
}
else
{
alert
(
'
Mentés nem sikerült!
'
);
}
}
catch
(
e
)
{
console
.
log
(
e
);
...
...
This diff is collapsed.
Click to expand it.
src/components/forms/AddSolutionForm.js
+
5
−
4
View file @
eab21544
import
React
,
{
Component
}
from
'
react
'
;
import
{
Modal
,
Button
,
Form
,
Input
,
TextArea
,
Icon
}
from
'
semantic-ui-react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
addSolution
,
writeSolution
,
writeSolutionFile
,
addDocument
}
from
'
../../actions/homework
'
;
import
{
addSolution
,
writeSolution
,
writeSolutionFile
,
addDocument
,
clearWrite
}
from
'
../../actions/homework
'
;
class
AddSolutionForm
extends
Component
{
constructor
(
props
)
{
...
...
@@ -19,9 +19,9 @@ class AddSolutionForm extends Component {
const
corrected
=
false
;
const
accepted
=
false
;
const
note
=
''
;
// const solution = (this.props.homeworks.solutions[this.props.homeworks.solutions.length - 1]).id
;
// TODO:
undefined
const
solution
=
1
;
let
solution
=
1
;
if
((
this
.
props
.
homeworks
.
solutions
[
this
.
props
.
homeworks
.
solutions
.
length
-
1
])
!==
undefined
)
solution
=
(
this
.
props
.
homeworks
.
solutions
[
this
.
props
.
homeworks
.
solutions
.
length
-
1
]).
id
;
return
(
<
Modal
open
=
{
this
.
state
.
showModal
}
...
...
@@ -93,4 +93,5 @@ export default connect(mapStateToProps, {
writeSolution
,
writeSolutionFile
,
addDocument
,
clearWrite
,
})(
AddSolutionForm
);
This diff is collapsed.
Click to expand it.
src/reducers/AddSolutionReducer.js
+
3
−
1
View file @
eab21544
import
{
WRITE_SOLUTION
,
WRITE_SOLUTION_FILE
,
GET_SOLUTIONS
}
from
'
../actions/types
'
;
import
{
WRITE_SOLUTION
,
WRITE_SOLUTION_FILE
,
GET_SOLUTIONS
,
CLEAR_WRITE
}
from
'
../actions/types
'
;
const
INITIAL_STATE
=
{
task
:
''
,
...
...
@@ -16,6 +16,8 @@ export default (state = INITIAL_STATE, action) => {
return
{
...
state
,
[
action
.
target
]:
action
.
payload
};
case
GET_SOLUTIONS
:
return
{
...
state
,
solutions
:
action
.
payload
};
case
CLEAR_WRITE
:
return
INITIAL_STATE
;
default
:
return
state
;
}
...
...
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