{ "version": 3, "sources": ["src/@omnial/_services/user-forms/user-forms.service.ts"], "sourcesContent": ["import { Injectable, OnDestroy } from '@angular/core';\r\nimport { Observable, Subscription } from 'rxjs';\r\nimport { UserFormSubmission } from 'src/@omnial/_models/user-forms/user-form-submission';\r\nimport { UserForm } from 'src/@omnial/_models/user-forms/user-form.model';\r\nimport { RepositoryService } from '../repository.service';\r\n\r\n@Injectable()\r\nexport class UserFormsService implements OnDestroy {\r\n private subscriptions: Subscription[] = [];\r\n\r\n constructor(private repoService: RepositoryService) { }\r\n\r\n ngOnDestroy(): void {\r\n if (this.subscriptions && this.subscriptions.length > 0) {\r\n this.subscriptions.forEach((sub) => { sub.unsubscribe() });\r\n }\r\n }\r\n\r\n public getUserFormById(formId: number): Observable {\r\n return new Observable((observer) => {\r\n this.subscriptions.push(this.repoService.getData(`UserForms/${formId}`).subscribe({\r\n next: (res) => {\r\n observer.next(res as UserForm);\r\n observer.complete();\r\n },\r\n error: (e) => {\r\n observer.error(e);\r\n observer.complete();\r\n }\r\n }));\r\n });\r\n }\r\n\r\n public submitForm(submission: UserFormSubmission): Observable {\r\n return new Observable((observer) => {\r\n this.subscriptions.push(this.repoService.create('UserForms/Submission', submission).subscribe({\r\n next: (res) => {\r\n observer.next(res as UserFormSubmission);\r\n observer.complete();\r\n },\r\n error: (e) => {\r\n observer.error(e);\r\n observer.complete();\r\n }\r\n }));\r\n });\r\n }\r\n}\r\n"], "mappings": "8DAOA,IAAaA,GAAgB,IAAA,CAAvB,MAAOA,CAAgB,CAG3BC,YAAoBC,EAA8B,CAA9B,KAAAA,YAAAA,EAFZ,KAAAC,cAAgC,CAAA,CAEc,CAEtDC,aAAW,CACL,KAAKD,eAAiB,KAAKA,cAAcE,OAAS,GACpD,KAAKF,cAAcG,QAASC,GAAO,CAAGA,EAAIC,YAAW,CAAG,CAAC,CAE7D,CAEOC,gBAAgBC,EAAc,CACnC,OAAO,IAAIC,EAAYC,GAAY,CACjC,KAAKT,cAAcU,KAAK,KAAKX,YAAYY,QAAQ,aAAaJ,CAAM,EAAE,EAAEK,UAAU,CAChFC,KAAOC,GAAO,CACZL,EAASI,KAAKC,CAAe,EAC7BL,EAASM,SAAQ,CACnB,EACAC,MAAQC,GAAK,CACXR,EAASO,MAAMC,CAAC,EAChBR,EAASM,SAAQ,CACnB,EACD,CAAC,CACJ,CAAC,CACH,CAEOG,WAAWC,EAA8B,CAC9C,OAAO,IAAIX,EAAYC,GAAY,CACjC,KAAKT,cAAcU,KAAK,KAAKX,YAAYqB,OAAO,uBAAwBD,CAAU,EAAEP,UAAU,CAC5FC,KAAOC,GAAO,CACZL,EAASI,KAAKC,CAAyB,EACvCL,EAASM,SAAQ,CACnB,EACAC,MAAQC,GAAK,CACXR,EAASO,MAAMC,CAAC,EAChBR,EAASM,SAAQ,CACnB,EACD,CAAC,CACJ,CAAC,CACH,iDAvCWlB,GAAgBwB,EAAAC,CAAA,CAAA,CAAA,CAAA,iCAAhBzB,EAAgB0B,QAAhB1B,EAAgB2B,SAAA,CAAA,CAAA,SAAhB3B,CAAgB,GAAA", "names": ["UserFormsService", "constructor", "repoService", "subscriptions", "ngOnDestroy", "length", "forEach", "sub", "unsubscribe", "getUserFormById", "formId", "Observable", "observer", "push", "getData", "subscribe", "next", "res", "complete", "error", "e", "submitForm", "submission", "create", "\u0275\u0275inject", "RepositoryService", "factory", "\u0275fac"] }