import { Component } from '@angular/core'
import * as jwt_decode from 'jwt-decode'

@Component({
  selector: 'app-last-login-ip',
  templateUrl: './last-login-ip.component.html',
  styleUrls: ['./last-login-ip.component.scss']

})

export class LastLoginIpComponent {

  lastLoginIp: string = '?'

  ngOnInit () {
    try {
      this.parseAuthToken()
    } catch (err) {
      console.log(err)
    }
  }

  parseAuthToken () {
    let payload = {} as any
    const token = localStorage.getItem('token')
    if (token) {
      payload = jwt_decode(token)
      if (payload.data.lastLoginIp) {
        this.lastLoginIp = payload.data.lastLoginIp
      }
    }
  }

}

import { Component } from '@angular/core'
import * as jwt_decode from 'jwt-decode'

@Component({
  selector: 'app-last-login-ip',
  templateUrl: './last-login-ip.component.html',
  styleUrls: ['./last-login-ip.component.scss']

})

export class LastLoginIpComponent {

  lastLoginIp: string = '?'

  ngOnInit () {
    try {
      this.parseAuthToken()
    } catch (err) {
      console.log(err)
    }
  }

  parseAuthToken () {
    let payload = {} as any
    const token = localStorage.getItem('token')
    if (token) {
      payload = jwt_decode(token, { header: true })
      if (payload.data.lastLoginIp) {
        this.lastLoginIp = payload.data.lastLoginIp
      }
    }
  }

}

--- 
+++ 
@@ -24,7 +24,7 @@
     let payload = {} as any
     const token = localStorage.getItem('token')
     if (token) {
-      payload = jwt_decode(token, { header: true })
+      payload = jwt_decode(token)
       if (payload.data.lastLoginIp) {
         this.lastLoginIp = payload.data.lastLoginIp
       }
Fix login ip not getting displayed

Co-Authored-By: MarcRler <6807ecce60afe4562dda8b75f8e7cd2bee819044@live.de>
