Hima 5 anos atrás
pai
commit
c00fbb6edf

+ 4 - 4
src/app/External-Page/external-page-header/external-page-header.component.html

@@ -8,8 +8,8 @@
                             <li class="profileData-w">
                                 <div class="dropdown">
                                     <button class="btn dropdown-toggle buttonW" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                        <img src="{{dataLoginUser.photo ? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
-                                        {{ dataLoginUser.name ? dataLoginUser.name : '' }} 
+                                        <img src="{{dataLoginUser? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
+                                        {{ dataLoginUser? dataLoginUser.name : 'user' }} 
                                     </button>
                                     <div class="dropdown-menu" style="text-align:right" aria-labelledby="dropdownMenuButton"> 
                                         <button class="dropdown-item" style="cursor: pointer;" >
@@ -133,8 +133,8 @@
                             <li class="profileData-w">
                                 <div class="dropdown">
                                     <button class="btn dropdown-toggle buttonW" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                        <img src="{{authSer.dataLoginUser['photo'] ? authSer.pathImg + authSer.dataLoginUser['photo'] : authSer.imgSrc}}" title="imageProfile" alt="" />
-                                        {{ authSer.dataLoginUser['name'] }}
+                                        <img src="{{dataLoginUser? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
+                                        {{ dataLoginUser? dataLoginUser.name : 'user' }}
                                     </button>
                                     <div class="dropdown-menu" style="text-align:right" aria-labelledby="dropdownMenuButton"> 
                                         <button class="dropdown-item" style="cursor: pointer;" >

+ 4 - 9
src/app/External-Page/external-page-header/external-page-header.component.ts

@@ -17,11 +17,8 @@ export class ExternalPageHeaderComponent implements OnInit {
     currentDate: any = Date.now();//ararbic date 
     currentEnglishDate: any = Date.now(); //english date
 
-    dataLoginUser = {
-      name: '',
-      photo: '',
-      id: '',
-    }
+    dataLoginUser: any;
+
 
   ngOnInit() {
 
@@ -32,10 +29,8 @@ export class ExternalPageHeaderComponent implements OnInit {
     this.currentDate = this.authSer.writeHijri(new Date(this.currentDate), 'ar', 'header');
     
     if(!this.authSer.isAuthenticated()) {
-      const userLoginData = JSON.parse(localStorage.getItem('userData'));
-      this.dataLoginUser.name = userLoginData ? userLoginData.name : '';
-      this.dataLoginUser.photo = userLoginData ? userLoginData.photo : '';
-      this.dataLoginUser.id = userLoginData ? userLoginData.id : null;
+      console.log('user data ', this.authSer.returnUserData());
+      this.dataLoginUser = JSON.parse(localStorage.getItem('userData'));
     }
 
     console.log(this.dataLoginUser);

+ 1 - 0
src/app/app.component.ts

@@ -1,3 +1,4 @@
+import { AuthServiceService } from 'src/app/shared/auth-service.service';
 import { NgxSpinnerService } from 'ngx-spinner';
 import { Component, OnInit } from '@angular/core';
 

+ 2 - 2
src/app/dashboard/header/header.component.html

@@ -11,8 +11,8 @@
                           <li class="profileData-w">
                             <div class="btn-group" ngbDropdown role="group" aria-label="Button group with nested dropdown">
                                 <button class="buttonW" ngbDropdownToggle>
-                                    <img src="{{dataLoginUser.photo ? authSer.pathImg + dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
-                                      {{dataLoginUser.name ? dataLoginUser.name : 'user' }} 
+                                    <img src="{{authSer.dataLoginUser? authSer.pathImg + authSer.dataLoginUser.photo : authSer.imgSrc}}" title="imageProfile" alt="" />
+                                      {{authSer.dataLoginUser? authSer.dataLoginUser.name : 'user' }} 
                                 </button>
                   
                             <div class="dropdown-menu" style="text-align:right" ngbDropdownMenu>

+ 3 - 10
src/app/dashboard/header/header.component.ts

@@ -21,11 +21,7 @@ export class HeaderComponent implements OnInit {
     
   currentDate: any = Date.now();
   
-  dataLoginUser = {
-    name: '',
-    photo: '',
-    id: '',
-  }
+  dataLoginUser: any;
 
   ngOnInit() {
 
@@ -36,13 +32,10 @@ export class HeaderComponent implements OnInit {
     this.authSer.checkExternalFooter = false;
 
     if(!this.authSer.isAuthenticated()) {
-      const userLoginData = JSON.parse(localStorage.getItem('userData'));
-      this.dataLoginUser.name = userLoginData ? userLoginData.name : '';
-      this.dataLoginUser.photo = userLoginData ? userLoginData.photo : '';
-      this.dataLoginUser.id = userLoginData ? userLoginData.id : null;
+      console.log('user data ', this.authSer.returnUserData());
+      this.dataLoginUser = JSON.parse(localStorage.getItem('userData'));
     }
 
-    console.log(this.dataLoginUser);
 
     if(this.authSer.checkExternalFooter) {
     } else {

+ 0 - 1
src/app/dashboard/tabs/add-tab/add-tab.component.html

@@ -67,7 +67,6 @@
 
             <div class="col-12 col-sm-12 col-md-4" style="margin-bottom:30px">
                 <div class="form-group text-center imgContainer">
-                
                   <button class="btn btn-default" *ngIf="checkShowDownloadFile" type="button" style="position: absolute; background:transparent; border:none; left:17px; top:32px"> <a href="{{authSer.pathImg + tab.file}}"><i class="fas fa-download"></i></a></button>
                 </div>
             </div>

+ 1 - 0
src/app/shared/auth-service.service.ts

@@ -71,6 +71,7 @@ export class AuthServiceService {
 
   dataLoginUser: any;
   
+  
   //login function
   login(dataForm) {
     console.log(dataForm);