const { secure, toast } = require("../../utils/api"); Page({ data: { pets: [] }, onShow() { this.load(); }, async load() { try { this.setData({ pets: await secure("/pets") }); } catch (e) { toast(e); } }, add() { wx.navigateTo({ url: "/pages/pet-edit/pet-edit" }); }, edit(e) { wx.navigateTo({ url: "/pages/pet-edit/pet-edit?id=" + e.currentTarget.dataset.id, }); }, });