PageRepository.ets 892 Bytes
import { ResponseDTO, WDHttp } from 'wdNetwork';
import { NavigationBodyDTO } from './bean/NavigationBodyDTO';
import { PageDTO } from './bean/PageDTO';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils } from '../network/HttpUrlUtils';

export class PageRepository {
  static fetchNavigationDataApi() {
    let url = HttpUrlUtils.getBottomNavGroupUrl();
    let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
    return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url, headers)
  };

  static fetchPageData(pageId: string, groupId: string, channelId: string, currentPage: number
                       , pageSize: number) {
    let url = HttpUrlUtils.getCompInfoUrl(pageId, groupId, channelId, currentPage, pageSize)
    let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
    return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
  };
}