added specific check for errortype for create newbranch redirect

This commit is contained in:
Florian Scholdei
2019-04-03 16:46:28 +02:00
parent c32b3fe6dc
commit c8fa40d520

View File

@@ -13,6 +13,7 @@ import {
} from "../modules/branches"; } from "../modules/branches";
import { ErrorPage, Loading } from "@scm-manager/ui-components"; import { ErrorPage, Loading } from "@scm-manager/ui-components";
import type { History } from "history"; import type { History } from "history";
import { NotFoundError } from "./errors";
type Props = { type Props = {
repository: Repository, repository: Repository,
@@ -63,7 +64,7 @@ class BranchRoot extends React.Component<Props> {
const url = this.matchedUrl(); const url = this.matchedUrl();
if (error) { if (error) {
if(location.search.indexOf("?create=true") > -1) { if(error instanceof NotFoundError && location.search.indexOf("?create=true") > -1) {
return <Redirect to={`/repo/${repository.namespace}/${repository.name}/branches/create?name=${match.params.branch}`} />; return <Redirect to={`/repo/${repository.namespace}/${repository.name}/branches/create?name=${match.params.branch}`} />;
} }