import { Component, OnInit } from '@angular/core';
Parse.initialize("dev");
(Parse as any).serverURL = 'http://web2023.fmode.cn:9999/parse'
import * as Parse from 'parse';
@Component({
  selector: 'app-hot-recommendations',
  templateUrl: './hot-recommendations.page.html',
  styleUrls: ['./hot-recommendations.page.scss'],
})
export class HotRecommendationsPage implements OnInit {

  recommendations: any[] = [];
  constructor() { }

  ngOnInit() {
    this.loadRecommendations();
  }

  async loadRecommendations() {
    const TuiJian = Parse.Object.extend('TuiJian');
    const query = new Parse.Query(TuiJian);
    try {
      const results = await query.find();
      this.recommendations = results.map(result => ({
        id: result.id,
        neirong: result.get('neirong'),
        image: result.get('image')
      }));
    } catch (error) {
      console.error('Error while fetching recommendations', error);
    }
  }
}
