Skip to content

Commit

Permalink
fix: solve form
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed Feb 18, 2024
1 parent c144d1e commit c64907a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions functions/src/cms4devfest-gdg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ const firestore = admin.firestore();
import { Axios } from "axios";
import { Configuration } from "./model";

export const updatePartnerToC4H = functions.firestore
export const onSendChangesToWebHooks = functions.firestore
.document("companies-2024/{companyId}")
.onUpdate(async (changes) => {
const configurationFromFirestore = await firestore
.doc("configuration/invoice_2024")
.get()
.then((invoice) => {
return invoice.data() as Configuration;
.then((configuration) => {
return configuration.data() as Configuration;
});

if (configurationFromFirestore.webhooks?.length! > 0) {
const client = new Axios();

Expand Down
1 change: 1 addition & 0 deletions public/src/app/register-form/register-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class RegisterFormComponent {
private readonly partnerservice = inject(PartnerService);

createPartner(company: Company) {
console.log(company);
this.partnerservice
.add({
...company,
Expand Down
1 change: 1 addition & 0 deletions public/src/app/services/partner.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class PartnerService {
private companiesCollection = collection(this.firestore, 'companies-2024');

public add(company: Company) {
console.log(company);
return addDoc(this.companiesCollection, {
...company,
status: {},
Expand Down
8 changes: 3 additions & 5 deletions public/src/app/ui/form/form.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
import { FormArray, ReactiveFormsModule } from '@angular/forms';
import { ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { Observable, of } from 'rxjs';
import { Company, Configuration } from '../../model/company';
Expand Down Expand Up @@ -160,7 +160,7 @@ export class FormComponent {
if (key.indexOf('options_') < 0) {
return {
...acc,
[key]: !!value,
[key]: value,
};
}
return {
Expand All @@ -180,8 +180,6 @@ export class FormComponent {
),
};

this.submitEvent.emit({
...company,
});
this.submitEvent.emit(company);
}
}

0 comments on commit c64907a

Please sign in to comment.