4f8861f4aa8a31817a49cff717bbe25e03d190db6c05e5a702eae1417cff49a8.json 7.1 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./tirage.component.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./tirage.component.scss?ngResource\";\nimport { Component } from '@angular/core';\nimport { AuthService } from 'src/app/services/auth.service';\nimport { UsersService } from 'src/app/services/users.service';\nimport { FormBuilder, Validators } from '@angular/forms';\nimport { HttpClient } from '@angular/common/http';\nimport { MatSnackBar } from '@angular/material/snack-bar';\nlet TirageComponent = class TirageComponent {\n constructor(authService, userService, fb, http, snackbar) {\n this.authService = authService;\n this.userService = userService;\n this.fb = fb;\n this.http = http;\n this.snackbar = snackbar;\n this.URL = \"http://localhost:4000\";\n this.messageError = null;\n this.tirage = {\n message: '',\n success: false\n };\n }\n ngOnInit() {\n this.authService.getUserInfo().subscribe(user => this.user = user);\n this.createdForm();\n }\n createdForm() {\n this.formTirage = this.fb.group({\n date: ['', Validators.required]\n });\n }\n postDateTirage() {\n console.log('date: ', this.formTirage.value);\n const tiragedate = this.formTirage.value;\n const reponse = this.http.post(`${this.URL}/api/tirage/date`, tiragedate);\n reponse.toPromise().then(res => {\n this.snackbar.open(res.message, 'close');\n }).catch(err => {\n console.log('message erreur =>', err.error.message);\n this.messageError = err.error.message;\n });\n }\n getTirage() {\n const resultatTirage = this.http.get(`${this.URL}/api/tirage`);\n resultatTirage.toPromise().then(res => {\n this.tirage = res;\n console.log('resultar ', this.tirage);\n }).catch(err => console.log('err', err));\n }\n getWinner(user) {}\n static #_ = this.ctorParameters = () => [{\n type: AuthService\n }, {\n type: UsersService\n }, {\n type: FormBuilder\n }, {\n type: HttpClient\n }, {\n type: MatSnackBar\n }];\n};\nTirageComponent = __decorate([Component({\n selector: 'app-tirage',\n template: __NG_CLI_RESOURCE__0,\n styles: [__NG_CLI_RESOURCE__1]\n})], TirageComponent);\nexport { TirageComponent };","map":{"version":3,"names":["Component","AuthService","UsersService","FormBuilder","Validators","HttpClient","MatSnackBar","TirageComponent","constructor","authService","userService","fb","http","snackbar","URL","messageError","tirage","message","success","ngOnInit","getUserInfo","subscribe","user","createdForm","formTirage","group","date","required","postDateTirage","console","log","value","tiragedate","reponse","post","toPromise","then","res","open","catch","err","error","getTirage","resultatTirage","get","getWinner","_","__decorate","selector","template","__NG_CLI_RESOURCE__0"],"sources":["C:\\FatboarProject\\angular-client\\src\\app\\components\\auth\\tirage\\tirage.component.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\r\nimport { AuthService } from 'src/app/services/auth.service';\r\nimport { UsersService } from 'src/app/services/users.service';\r\nimport { User } from '../../../models/userResponse';\r\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { Tirage} from 'src/app/models/tirage';\r\nimport { MatSnackBar } from '@angular/material/snack-bar';\r\n\r\ninterface httpResponse {\r\n message: string,\r\n success: boolean,\r\n\r\n}\r\n\r\n@Component({\r\n selector: 'app-tirage',\r\n templateUrl: './tirage.component.html',\r\n styleUrls: ['./tirage.component.scss']\r\n})\r\nexport class TirageComponent implements OnInit {\r\n\r\n private readonly URL = \"http://localhost:4000\"\r\n user: User\r\n formTirage: FormGroup\r\n messageError: string = null \r\n tirage: httpResponse = {\r\n message: '',\r\n success: false,\r\n }\r\n constructor(private authService : AuthService, private userService : UsersService, private fb : FormBuilder, private http: HttpClient, private snackbar: MatSnackBar) { }\r\n\r\n ngOnInit(): void {\r\n this.authService.getUserInfo().subscribe(user => this.user = user)\r\n this.createdForm()\r\n }\r\n\r\n createdForm() {\r\n this.formTirage = this.fb.group({\r\n date: ['', Validators.required]\r\n })\r\n }\r\n\r\n postDateTirage() {\r\n console.log('date: ', this.formTirage.value)\r\n const tiragedate = this.formTirage.value as Date\r\n const reponse = this.http.post<httpResponse>(`${this.URL}/api/tirage/date`, tiragedate)\r\n reponse.toPromise().then( res => {\r\n this.snackbar.open(res.message, 'close')\r\n }).catch(err => {\r\n console.log('message erreur =>', err.error.message)\r\n this.messageError = err.error.message\r\n })\r\n\r\n }\r\n \r\n getTirage() {\r\n const resultatTirage = this.http.get<httpResponse>(`${this.URL}/api/tirage`)\r\n resultatTirage.toPromise().then(\r\n (res) => {\r\n this.tirage = res\r\n console.log('resultar ', this.tirage)\r\n }\r\n ).catch(\r\n err => console.log('err', err)\r\n )\r\n }\r\n\r\n getWinner(user: User) {\r\n\r\n }\r\n\r\n}\r\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAgB,eAAe;AACjD,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,YAAY,QAAQ,gCAAgC;AAE7D,SAASC,WAAW,EAAaC,UAAU,QAAQ,gBAAgB;AACnE,SAASC,UAAU,QAAQ,sBAAsB;AAEjD,SAASC,WAAW,QAAQ,6BAA6B;AAalD,IAAMC,eAAe,GAArB,MAAMA,eAAe;EAU1BC,YAAoBC,WAAyB,EAAUC,WAA0B,EAAUC,EAAgB,EAAUC,IAAgB,EAAUC,QAAqB;IAAhJ,KAAAJ,WAAW,GAAXA,WAAW;IAAwB,KAAAC,WAAW,GAAXA,WAAW;IAAyB,KAAAC,EAAE,GAAFA,EAAE;IAAwB,KAAAC,IAAI,GAAJA,IAAI;IAAsB,KAAAC,QAAQ,GAARA,QAAQ;IARtI,KAAAC,GAAG,GAAG,uBAAuB;IAG9C,KAAAC,YAAY,GAAW,IAAI;IAC3B,KAAAC,MAAM,GAAiB;MACrBC,OAAO,EAAE,EAAE;MACXC,OAAO,EAAE;KACV;EACuK;EAExKC,QAAQA,CAAA;IACN,IAAI,CAACV,WAAW,CAACW,WAAW,EAAE,CAACC,SAAS,CAACC,IAAI,IAAI,IAAI,CAACA,IAAI,GAAGA,IAAI,CAAC;IAClE,IAAI,CAACC,WAAW,EAAE;EACpB;EAEAA,WAAWA,CAAA;IACT,IAAI,CAACC,UAAU,GAAG,IAAI,CAACb,EAAE,CAACc,KAAK,CAAC;MAC9BC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