File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import AuthenticationLayout from '../projects/authentication/AuthenticationLayou
8
8
import DatabaseHome from '../projects/database/DatabaseHome'
9
9
import DatabaseLayout from '../projects/database/DatabaseLayout'
10
10
11
- const ProjectSubLayout = ( { match } ) => {
11
+ const ProjectSubLayout = ( { match, pathname } ) => {
12
12
const [ project , setProject ] = useState ( false )
13
13
const { projectId } = match . params
14
14
@@ -30,7 +30,9 @@ const ProjectSubLayout = ({ match }) => {
30
30
< nav className = "project-nav horizontal-spacing" style = { { color : 'white' } } >
31
31
< span className = "text-light-tint" > { project . name } </ span >
32
32
< span > : </ span >
33
- < Link to = "/projects/add" className = "text-light-tint" >
33
+ < Link
34
+ to = { { pathname : '/projects/add' , state : { cancelPathname : location . pathname } } }
35
+ className = "text-light-tint" >
34
36
Add Project
35
37
</ Link >
36
38
</ nav >
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React, { useState } from 'react'
2
2
import { Link , Prompt } from 'react-router-dom'
3
3
import Card from '../ui/Card'
4
4
5
- const AddProject = ( ) => {
5
+ const AddProject = ( { location } ) => {
6
6
const [ formIsDirty , setFormIsDirty ] = useState ( false )
7
7
8
8
function handleSubmit ( e ) {
@@ -16,9 +16,9 @@ const AddProject = () => {
16
16
< input onChange = { ( ) => setFormIsDirty ( true ) } type = "text" placeholder = "Project Name" required />
17
17
< footer className = "horizontal-spacing" >
18
18
< button type = "submit" className = "button" >
19
- Add Project.
19
+ Add Project
20
20
</ button >
21
- < Link to = " /projects" > Cancel</ Link >
21
+ < Link to = { ( location . state && location . state . cancelPathname ) || ' /projects' } > Cancel</ Link >
22
22
</ footer >
23
23
</ form >
24
24
</ Card >
You can’t perform that action at this time.
0 commit comments