aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/account/account.model.ts
blob: cc46dad77d1cca24e6d371ab183787f3d60edf54 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                                            
                                                                          
                                                               
                                                 




                                               
                     






                        

                                                    
 


                                                                              

   
import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model'
import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
import { environment } from '../../../environments/environment'
import { getAbsoluteAPIUrl } from '../misc/utils'

export class Account implements ServerAccount {
  id: number
  uuid: string
  name: string
  displayName: string
  host: string
  followingCount: number
  followersCount: number
  createdAt: Date
  updatedAt: Date
  avatar: Avatar

  static GET_ACCOUNT_AVATAR_URL (account: Account) {
    const absoluteAPIUrl = getAbsoluteAPIUrl()

    if (account && account.avatar) return absoluteAPIUrl + account.avatar.path

    return window.location.origin + '/client/assets/images/default-avatar.png'
  }
}