-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec page #79
base: development
Are you sure you want to change the base?
Spec page #79
Changes from 8 commits
784fe63
775d0ab
798b59d
d4be4ec
769d0b3
6330e67
a8f4988
7922b59
f6a77e1
91c95da
385b4f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import React, { ComponentType } from 'react'; | ||
import { Redirect, Route, Switch } from 'react-router-dom'; | ||
|
||
import { AddSdkConfigModal } from './AddSdkConfigModal'; | ||
import { AddSpecModal } from './AddSpecModal'; | ||
import { NotFound } from './basic/NotFound'; | ||
import { createStyled } from './createStyled'; | ||
import { DeleteSpecModal } from './DeleteSpecModal'; | ||
import { NavigationMenu } from './NavigationMenu'; | ||
import { Overview } from './Overview'; | ||
import { ProfileViewer } from './ProfileViewer'; | ||
|
@@ -50,6 +53,18 @@ export const Page: ComponentType<{}> = () => ( | |
<Route path="/settings" component={SettingsViewer} /> | ||
<Route component={NotFound} /> | ||
</Switch> | ||
<Route exact path="/specs/:specId/edit" component={AddSpecModal} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realise this is kind of messy, but these routes no longer work in the Overview component since they're all triggered from the /specs/... route now, and I couldn't get these Route components to work inside SpecViewer since I couldn't extract the specId match prop, since it's part of the match in Page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried doing something like |
||
<Route exact path="/specs/:specId/delete" component={DeleteSpecModal} /> | ||
<Route | ||
exact | ||
path="/specs/:specId/sdk-configs/add" | ||
component={AddSdkConfigModal} | ||
/> | ||
<Route | ||
exact | ||
path="/specs/:specId/sdk-configs/:sdkConfigId/edit" | ||
component={AddSdkConfigModal} | ||
/> | ||
</main> | ||
</div> | ||
)} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work? Why use
replace
instead of appendingoverview
to the end of the base URL?What if we're closing the modal from a page other than the overview pages - Won't it go to the overview page instead of the original page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it’s delete - if we’re deleting the entire spec we can’t stay on the spec page, because there’ll be nothing there.
Juat dismissing the modal without deleting won’t go to overview.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just do
this.props.history.push(goUpUrl(this.props.match.url, 3) + '/overview')
?The problem with the way you've got it at the moment is that if you have a base url that has "specs" in it, say,
openapi.specsavers.com/specs/1/delete
you'll end up withopenapi.overviewavers/overview
.