@@ -12,15 +12,15 @@ import {singleSelectStyle} from "./constants"
1212import Select from 'react-select'
1313
1414export const NewBranchModal = ( { newBranch, onCancel, createBranch, loading} ) => {
15- const { branches , branch, ref} = WOQLClientObj ( )
15+ const { branch, ref} = WOQLClientObj ( )
1616
1717 const [ id , setID ] = useState ( false )
1818 const [ select , setSelect ] = useState ( newBranchForm . select . head )
1919 const [ reportAlert , setReportAlert ] = useState ( false )
2020
2121 function handleCreate ( e ) {
2222 event . preventDefault ( )
23- if ( checkSubmission ( id , branches , setReportAlert ) ) {
23+ if ( checkSubmission ( id , setReportAlert ) ) {
2424 createBranch ( { id : id , branchType : select } )
2525 }
2626 }
@@ -70,24 +70,16 @@ export const NewBranchModal = ({newBranch, onCancel, createBranch, loading}) =>
7070 </ Modal >
7171}
7272
73- function checkSubmission ( newID , branches , setReportAlert ) {
73+ function checkSubmission ( newID , setReportAlert ) {
7474 if ( newID && newID . length ) {
7575 let nid = newID . trim ( )
76- if ( typeof branches [ nid ] != "undefined" ) {
77- let message = "A Branch already exists with the same ID - choose a new ID"
78- setReportAlert ( < Alerts message = { message } type = { TERMINUS_DANGER } onCancel = { setReportAlert } /> )
79- return false
80- }
81- else {
8276 if ( ! legalURLID ( nid ) ) {
8377 let message = "Branch IDs can only include lowercase characters, numbers and underscores and be no more than 40 characters long"
8478 setReportAlert ( < Alerts message = { message } type = { TERMINUS_WARNING } onCancel = { setReportAlert } /> )
8579 return false
8680 }
8781 return true
88- }
89- }
90- else {
82+ } else {
9183 let message = "You must supply an ID for the new Branch"
9284 setReportAlert ( < Alerts message = { message } type = { TERMINUS_WARNING } onCancel = { setReportAlert } /> )
9385 return false
0 commit comments