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
9893786a
Commit
9893786a
authored
7 years ago
by
Tamás Szabó
Browse files
Options
Downloads
Patches
Plain Diff
motivation with three questions
parent
f8fddf01
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/auth.js
+15
-7
15 additions, 7 deletions
src/actions/auth.js
src/actions/types.js
+0
-2
0 additions, 2 deletions
src/actions/types.js
src/reducers/UserReducer.js
+0
-3
0 additions, 3 deletions
src/reducers/UserReducer.js
with
15 additions
and
12 deletions
src/actions/auth.js
+
15
−
7
View file @
9893786a
// TODO: Separate actions
// TODO: Separate actions
import
ax
from
'
axios
'
;
import
ax
from
'
axios
'
;
import
{
GET_USERDATA
,
PROFILE_CHANGE
,
GROUP_CHANGE
,
LOGOUT
,
GET_NEWS
}
from
'
./types
'
;
import
{
GET_USERDATA
,
PROFILE_CHANGE
,
GROUP_CHANGE
,
GET_NEWS
}
from
'
./types
'
;
const
axios
=
ax
.
create
({
const
axios
=
ax
.
create
({
xsrfCookieName
:
'
csrftoken
'
,
xsrfCookieName
:
'
csrftoken
'
,
...
@@ -12,12 +12,15 @@ export const getUserData = () => (
...
@@ -12,12 +12,15 @@ export const getUserData = () => (
async
(
dispatch
)
=>
{
async
(
dispatch
)
=>
{
const
user
=
await
axios
.
get
(
'
/api/v1/profiles/me
'
);
const
user
=
await
axios
.
get
(
'
/api/v1/profiles/me
'
);
const
{
const
{
id
,
join_date
:
joinDate
,
nick
,
motivation
,
signed
,
groups
,
id
,
join_date
:
joinDate
,
nick
,
motivation_about
:
motivationAbout
,
motivation_profession
:
motivationProfession
,
motivation_exercise
:
motivationExercise
,
signed
,
groups
,
}
=
user
.
data
;
}
=
user
.
data
;
const
motivationJSON
=
JSON
.
parse
(
motivation
);
const
motivationAbout
=
motivationJSON
.
first
;
const
motivationProfession
=
motivationJSON
.
second
;
const
motivationExercise
=
motivationJSON
.
third
;
dispatch
({
dispatch
({
type
:
GET_USERDATA
,
type
:
GET_USERDATA
,
payload
:
{
payload
:
{
...
@@ -55,7 +58,12 @@ export const submitRegistration = ({
...
@@ -55,7 +58,12 @@ export const submitRegistration = ({
})
=>
(
})
=>
(
async
(
dispatch
)
=>
{
async
(
dispatch
)
=>
{
const
response
=
await
axios
.
patch
(
`/api/v1/profiles/
${
id
}
/`
,
{
const
response
=
await
axios
.
patch
(
`/api/v1/profiles/
${
id
}
/`
,
{
nick
,
groups
,
signed
,
motivation
:
JSON
.
stringify
({
first
:
motivationAbout
,
second
:
motivationProfession
,
third
:
motivationExercise
}),
nick
,
groups
,
signed
,
motivation_about
:
motivationAbout
,
motivation_profession
:
motivationProfession
,
motivation_exercise
:
motivationExercise
,
});
});
if
(
response
.
data
.
id
===
id
)
{
if
(
response
.
data
.
id
===
id
)
{
alert
(
'
Sikeres mentés!
'
);
alert
(
'
Sikeres mentés!
'
);
...
...
This diff is collapsed.
Click to expand it.
src/actions/types.js
+
0
−
2
View file @
9893786a
...
@@ -3,5 +3,3 @@ export const GET_NEWS = 'get_news';
...
@@ -3,5 +3,3 @@ export const GET_NEWS = 'get_news';
export
const
PROFILE_CHANGE
=
'
profile_change
'
;
export
const
PROFILE_CHANGE
=
'
profile_change
'
;
export
const
GROUP_CHANGE
=
'
group_change
'
;
export
const
GROUP_CHANGE
=
'
group_change
'
;
export
const
LOGOUT
=
'
logout
'
;
This diff is collapsed.
Click to expand it.
src/reducers/UserReducer.js
+
0
−
3
View file @
9893786a
...
@@ -2,7 +2,6 @@ import {
...
@@ -2,7 +2,6 @@ import {
GET_USERDATA
,
GET_USERDATA
,
PROFILE_CHANGE
,
PROFILE_CHANGE
,
GROUP_CHANGE
,
GROUP_CHANGE
,
LOGOUT
,
}
from
'
../actions/types
'
;
}
from
'
../actions/types
'
;
const
INITIAL_STATE
=
{
const
INITIAL_STATE
=
{
...
@@ -16,8 +15,6 @@ export default (state = INITIAL_STATE, action) => {
...
@@ -16,8 +15,6 @@ export default (state = INITIAL_STATE, action) => {
return
{
...
state
,
[
action
.
target
]:
action
.
payload
};
return
{
...
state
,
[
action
.
target
]:
action
.
payload
};
case
GROUP_CHANGE
:
case
GROUP_CHANGE
:
return
{
...
state
,
groups
:
action
.
payload
};
return
{
...
state
,
groups
:
action
.
payload
};
case
LOGOUT
:
return
INITIAL_STATE
;
default
:
default
:
return
state
;
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