1 line
5.1 KiB
JSON
1 line
5.1 KiB
JSON
{"ast":null,"code":"import Swal from 'sweetalert2';\nimport { MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"../services/authentication.service\";\nimport * as i2 from \"@angular/common\";\nimport * as i3 from \"@angular/forms\";\nexport let LoginComponent = /*#__PURE__*/(() => {\n class LoginComponent {\n constructor(authService, data) {\n this.authService = authService;\n this.data = data;\n this.username = '';\n this.password = '';\n this.waitRes = false;\n this.IsPwdHidden = true;\n this.afterLogin = () => {};\n //localStorage.getItem('theme') === 'dark'\n if (typeof this.afterLogin == typeof data.afterLogin) this.afterLogin = data.afterLogin;\n }\n login() {\n this.waitRes = true;\n this.authService.login(this.username, this.password).subscribe({\n next: () => this.afterLogin(),\n error: err => {\n this.waitRes = false;\n Swal.fire({\n icon: \"error\",\n title: \"Oops...\",\n text: err.error.messages.join(\"\\n\")\n });\n },\n complete: () => this.waitRes = false\n });\n }\n onPasswordEyeClicked() {\n this.IsPwdHidden = !this.IsPwdHidden;\n }\n static #_ = this.ɵfac = function LoginComponent_Factory(t) {\n return new (t || LoginComponent)(i0.ɵɵdirectiveInject(i1.AuthenticationService), i0.ɵɵdirectiveInject(MAT_DIALOG_DATA));\n };\n static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: LoginComponent,\n selectors: [[\"app-login\"]],\n inputs: {\n afterLogin: \"afterLogin\"\n },\n decls: 19,\n vars: 8,\n consts: [[1, \"container\", \"p-0\", \"m-0\"], [1, \"row\", \"justify-content-center\", \"p-0\", \"m-0\"], [1, \"col\", \"p-0\", \"m-0\"], [1, \"card\", \"px-5\"], [1, \"card-body\", \"mx-5\", \"px-5\"], [3, \"ngSubmit\"], [1, \"mb-3\"], [\"for\", \"username\", 1, \"form-label\"], [\"type\", \"text\", \"name\", \"Username\", \"required\", \"\", 1, \"form-control\", 3, \"ngModelChange\", \"ngModel\"], [\"for\", \"password\", 1, \"form-label\"], [1, \"d-flex\"], [\"type\", \"password\", \"name\", \"Password\", \"required\", \"\", 1, \"form-control\", 3, \"ngModelChange\", \"type\", \"ngModel\"], [3, \"click\", \"ngClass\"], [\"type\", \"submit\", 1, \"btn\", \"btn-primary\"], [\"aria-hidden\", \"true\"]],\n template: function LoginComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 0)(1, \"div\", 1)(2, \"div\", 2)(3, \"div\", 3)(4, \"div\", 4)(5, \"form\", 5);\n i0.ɵɵlistener(\"ngSubmit\", function LoginComponent_Template_form_ngSubmit_5_listener() {\n return ctx.login();\n });\n i0.ɵɵelementStart(6, \"div\", 6)(7, \"label\", 7);\n i0.ɵɵtext(8, \"Benutzername\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(9, \"input\", 8);\n i0.ɵɵtwoWayListener(\"ngModelChange\", function LoginComponent_Template_input_ngModelChange_9_listener($event) {\n i0.ɵɵtwoWayBindingSet(ctx.username, $event) || (ctx.username = $event);\n return $event;\n });\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(10, \"div\", 6)(11, \"label\", 9);\n i0.ɵɵtext(12, \"Kennwort\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(13, \"div\", 10)(14, \"input\", 11);\n i0.ɵɵtwoWayListener(\"ngModelChange\", function LoginComponent_Template_input_ngModelChange_14_listener($event) {\n i0.ɵɵtwoWayBindingSet(ctx.password, $event) || (ctx.password = $event);\n return $event;\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(15, \"i\", 12);\n i0.ɵɵlistener(\"click\", function LoginComponent_Template_i_click_15_listener() {\n return ctx.onPasswordEyeClicked();\n });\n i0.ɵɵelementEnd()()();\n i0.ɵɵelementStart(16, \"button\", 13);\n i0.ɵɵelement(17, \"span\", 14);\n i0.ɵɵtext(18, \"Anmeldung\");\n i0.ɵɵelementEnd()()()()()()();\n }\n if (rf & 2) {\n i0.ɵɵadvance(9);\n i0.ɵɵtwoWayProperty(\"ngModel\", ctx.username);\n i0.ɵɵadvance(5);\n i0.ɵɵproperty(\"type\", ctx.IsPwdHidden ? \"password\" : \"text\");\n i0.ɵɵtwoWayProperty(\"ngModel\", ctx.password);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngClass\", \"bi \" + (ctx.IsPwdHidden ? \"bi-eye-slash\" : \"bi-eye\") + \" mt-2\");\n i0.ɵɵadvance(2);\n i0.ɵɵclassProp(\"spinner-border\", ctx.waitRes)(\"spinner-border-sm\", ctx.waitRes);\n }\n },\n dependencies: [i2.NgClass, i3.ɵNgNoValidate, i3.DefaultValueAccessor, i3.NgControlStatus, i3.NgControlStatusGroup, i3.RequiredValidator, i3.NgModel, i3.NgForm],\n styles: [\"i[_ngcontent-%COMP%]{margin-left:-30px;cursor:pointer}\"]\n });\n }\n return LoginComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]} |