private deleteRepo()

in web/gr-delete-repo.ts [143:175]


  private deleteRepo() {
    if (!this.action) {
      this.error = 'delete action undefined';
      this.deleteRepoOverlay?.close();
      return;
    }
    if (!this.action.method) {
      this.error = 'delete action does not have a HTTP method set';
      this.deleteRepoOverlay?.close();
      return;
    }
    this.error = undefined;

    const endpoint = `/projects/${encodeURIComponent(this.repoName)}/${
      this.actionId
    }`;
    const json = {
      force: this.forceDeleteOpenChangesCheckBox?.checked ?? false,
      preserve: this.preserveGitRepoCheckBox?.checked ?? false,
    };
    return this.plugin
      .restApi()
      .send(this.action.method, endpoint, json)
      .then(_ => {
        this.plugin.restApi().invalidateReposCache();
        this.deleteRepoOverlay?.close();
        window.location.href = `${this.getBaseUrl()}/admin/repos`;
      })
      .catch(e => {
        this.error = e;
        this.deleteRepoOverlay?.close();
      });
  }