async function handleBranches()

in streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx [290:311]


  async function handleBranches(values: Recordable) {
    const hide = createMessage.loading('Getting branch');
    try {
      const url = values.url;
      if (url) {
        const gitCredential = values.gitCredential;
        const userName = values.userName || null;
        const password = values.password || null;
        const prvkeyPath = values.prvkeyPath || null;
        const userNull = userName === null || userName === undefined || userName === '';
        const passNull = password === null || password === undefined || password === '';
        if ((userNull && passNull) || (!userNull && !passNull)) {
          const res = await fetchBranches({ gitCredential, url, userName, password, prvkeyPath });
          if (res) branchList.value = res.map((i) => ({ label: i, value: i }));
        }
      }
    } catch (error) {
      console.error(error);
    } finally {
      hide();
    }
  }