small code improvement

This commit is contained in:
Florian Scholdei
2019-04-01 15:32:29 +02:00
parent d6ead4fa82
commit 2ba57dc141

View File

@@ -27,10 +27,11 @@ export const FETCH_BRANCH_FAILURE = `${FETCH_BRANCH}_${FAILURE_SUFFIX}`;
// Fetching branches
export function fetchBranchByName(link: string, name: string) {
const branchUrl = link.endsWith("/")
? link + encodeURIComponent(name)
: link + "/" + encodeURIComponent(name);
return fetchBranch(branchUrl, name);
let endsWith = "";
if(!link.endsWith("/")) {
endsWith = "/";
}
return fetchBranch(link + endsWith + encodeURIComponent(name), name);
}
export function fetchBranchPending(name: string): Action {