move redirect logic to legacy plugin / bind Extensionpoint in Main.js

This commit is contained in:
Eduard Heimbuch
2019-07-04 12:13:45 +02:00
parent 7211d657f2
commit 4f1ac2af09
4 changed files with 95 additions and 10 deletions

View File

@@ -38,15 +38,6 @@ class Main extends React.Component<Props> {
const { authenticated, links } = this.props;
const redirectUrlFactory = binder.getExtension("main.redirect", this.props);
let url = "/repos";
if (location.href && location.href.includes("#diffPanel;")) {
let repoId = location.href.substring(location.href.search("#diffPanel;") + 11, location.href.search("#diffPanel;") + 21);
console.log("RepoId:");
console.log(repoId);
apiClient.get("/legacy/repository/" + repoId).then(response =>
console.log(JSON.parse(response))
// this.props.history.push("/repo/" + response.responseBody.namespace + "/" + response.responseBody.name)
);
}
if (redirectUrlFactory) {
url = redirectUrlFactory(this.props);
}
@@ -134,7 +125,11 @@ class Main extends React.Component<Props> {
component={Profile}
authenticated={authenticated}
/>
<ExtensionPoint
name="legacyRepository.redirect"
renderAll={true}
props={{ authenticated }}
/>
<ExtensionPoint
name="main.route"
renderAll={true}