Skip to content

Conversation

pagum
Copy link
Contributor

@pagum pagum commented Feb 8, 2023

update User to return picture

@pagum pagum requested review from Ndifreke and shakaman February 8, 2023 13:18
@pagum pagum self-assigned this Feb 8, 2023
@Ndifreke
Copy link
Contributor

Ndifreke commented Feb 10, 2023

@pagum this would be a great opportunity to fix the type of this Component.
There seem to be some types that should belong to /me which are mixed up here the proper type for User is

export interface UserInterface {
  id: string;
  deactivated: boolean;
  namespace: string;
  username: string;
  email: string;
  email_verified?: boolean;
  first_name: string;
  last_name: string;
  picture: string;
  company: string;
  website: string;
  country: string;
  created_at: string;
  updated_at: string;
  phone_number_verified: boolean
  mfa_enabled: boolean
}

export default class User extends Ressource implements UserInterface {
  id: string;
  created_at: string;
  updated_at: string;
  has_key: boolean;
  // display_name: string; Does not exist in User but in Me
  email: string;
  username: string;
  deactivated: boolean;
  namespace: string;
  email_verified?: boolean;
  first_name: string;
  last_name: string;
  picture = "";
  company: string;
  website : string;
  country: string;
  phone_number_verified = false;
  mfa_enabled = false

  constructor(user: APIObject, url = `${_url}/:id`, modifiableField: Array<string> = []) {
    const { id } = user;

    super(url, paramDefaults, { id }, user, [], modifiableField);
    this._queryUrl = Ressource.getQueryUrl(url);
    this.id = "";
    this.created_at = "";
    this.updated_at = "";
    this.has_key = false;
    this.email = "";
    this.username = "";
    this.country = "";
    this.website = "";
    this.company = "";
    this.last_name = "";
    this.first_name = "";
    this.deactivated = false;
    this.namespace = "";
  }

You will have to remove this.picture from Me and let the super class handle the construction and then move this.display_name to Me

@shakaman shakaman force-pushed the master branch 3 times, most recently from 6f68b7a to 5485ae1 Compare June 14, 2023 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants