/**
 * 浏览足迹
 * 对齐后端 /api/user/browse-history
 */
const api = require('../../utils/api');

Page({
  data: {
    loading: true,
    list: []
  },

  onShow() {
    this.loadList();
  },

  async loadList() {
    this.setData({ loading: true });
    const res = await api.getBrowseHistory({ page: 1, pageSize: 50 }).catch(() => []);
    const list = (res && res.list) || res || [];
    this.setData({ list: Array.isArray(list) ? list : [], loading: false });
  }
});
