Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-elife
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-elife
Merge requests
!16
Persist submission form values with apollo-link-state
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Persist submission form values with apollo-link-state
persist-submission-state
into
master
Overview
6
Commits
6
Pipelines
9
Changes
7
Merged
Aanand Prasad
requested to merge
persist-submission-state
into
master
7 years ago
Overview
6
Commits
6
Pipelines
9
Changes
7
Expand
To try it out:
On the dashboard, click "Submit a manuscript"
Fill out the form
Click "Next"
On the file upload dummy page, click "Author details" to return to the form
The values you entered should still be there
Edited
7 years ago
by
Aanand Prasad
1
0
Merge request reports
Compare
master
version 9
262f9b80
7 years ago
version 8
b62c9738
7 years ago
version 7
a66e945b
7 years ago
version 6
44bb22c3
7 years ago
version 5
ef576a18
7 years ago
version 4
cd27131e
7 years ago
version 3
cd27131e
7 years ago
version 2
53c6da24
7 years ago
version 1
a7aadcc7
7 years ago
master (base)
and
latest version
latest version
52db1874
6 commits,
7 years ago
version 9
262f9b80
5 commits,
7 years ago
version 8
b62c9738
4 commits,
7 years ago
version 7
a66e945b
3 commits,
7 years ago
version 6
44bb22c3
2 commits,
7 years ago
version 5
ef576a18
1 commit,
7 years ago
version 4
cd27131e
1 commit,
7 years ago
version 3
cd27131e
3 commits,
7 years ago
version 2
53c6da24
4 commits,
7 years ago
version 1
a7aadcc7
4 commits,
7 years ago
7 files
+
118
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
app/components/submission/AuthorDetailsPage.js
+
53
−
8
Options
import
React
from
'
react
'
import
{
Formik
}
from
'
formik
'
import
{
withRouter
}
from
'
react-router-dom
'
import
{
Mutation
,
Query
}
from
'
react-apollo
'
import
gql
from
'
graphql-tag
'
import
AuthorDetails
from
'
./AuthorDetails
'
import
{
schema
,
empty
}
from
'
./AuthorDetailsSchema
'
import
{
schema
}
from
'
./AuthorDetailsSchema
'
const
GET_AUTHOR_DETAILS
=
gql
`
query {
currentSubmission @client {
firstName
lastName
email
institute
assignee {
firstName
lastName
email
}
}
}
`
const
UPDATE_AUTHOR_DETAILS
=
gql
`
mutation($input: Submission) {
updateCurrentSubmission(input: $input) @client
}
`
const
AuthorDetailsPage
=
({
history
})
=>
(
<
Formik
component
=
{
AuthorDetails
}
initialValues
=
{
empty
}
onSubmit
=
{
values
=>
{
history
.
push
(
'
/submit/upload
'
)
<
Query
query
=
{
GET_AUTHOR_DETAILS
}
>
{({
loading
,
error
,
data
,
client
})
=>
{
if
(
loading
)
return
<
div
>
Loading
...
<
/div
>
if
(
error
)
{
console
.
error
(
error
)
return
<
div
>
{
String
(
error
)}
<
/div
>
}
return
(
<
Mutation
mutation
=
{
UPDATE_AUTHOR_DETAILS
}
>
{
updateAuthorDetails
=>
(
<
Formik
component
=
{
AuthorDetails
}
initialValues
=
{
data
.
currentSubmission
}
onSubmit
=
{
values
=>
updateAuthorDetails
({
variables
:
{
input
:
values
},
}).
then
(()
=>
{
history
.
push
(
'
/submit/upload
'
)
})
}
validationSchema
=
{
schema
}
/
>
)}
<
/Mutation
>
)
}}
validationSchema
=
{
schema
}
/
>
<
/Query
>
)
export
default
withRouter
(
AuthorDetailsPage
)