async ngOnInit()

in src/app/dashboard/dashboard.component.ts [38:106]


  async ngOnInit() {

    // // TODO : Add loggedin user filter
    // // TODO : add filter for current week and month

    this.week = moment().format('WW');
    this.month = moment().format('MM');
    this.year = moment().format('gggg');

    const weeklyresponse = await this.api.ListReminders({
      user: {
        eq: this.appcomponent.user.attributes.email
      },
      type: {
        eq: frequency.WEEKLY
      },
      week: {
        eq: this.week
      }

    });

    const monthlyresponse = await this.api.ListReminders({
      user: {
        eq: this.appcomponent.user.attributes.email
      },
      type: {
        eq: frequency.MONTHLY
      },
      month: {
        eq: this.month
      }
    });

    const yearlyresponse = await this.api.ListReminders({
      user: {
        eq: this.appcomponent.user.attributes.email
      },
      type: {
        eq: frequency.YEARLY
      },
      year: {
        eq: this.year
      }

    });

    this.dashboardMonthlyData = monthlyresponse.items;
    this.dashboardWeeklyData = weeklyresponse.items;
    this.dashboardYearlyData = yearlyresponse.items;

    if (this.dashboardMonthlyData.length == 0) {
      await this.populateMissingReminders(frequency.MONTHLY);

    }
    if (this.dashboardWeeklyData.length == 0) {
      await this.populateMissingReminders(frequency.WEEKLY);

    }
    // todo : populate the TAM Goals without customer
    console.log('Tam goal length', this.dashboardYearlyData.length);
    if (this.dashboardYearlyData.length == 0) {
      await this.populateTamGoals(frequency.YEARLY);

    }



  }