public async submitForm()

in src/features/extensions-page/extension-store.ts [65:90]


  public async submitForm(modelToSubmit: ExtensionModel) {
    this.isLoading = true;
    this.formState = {
      success: true,
      errors: [],
    };

    const response =
      modelToSubmit.id === ""
        ? await CreateExtension(modelToSubmit)
        : await UpdateExtension(modelToSubmit);

    if (response.status !== "OK") {
      this.formState = {
        success: false,
        errors: response.errors,
      };
    } else {
      RevalidateCache({
        page: "extensions",
      });
    }

    this.isLoading = false;
    this.isOpened = !this.formState.success;
  }