Complete core mini program flows
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const { secure, toast } = require("../../utils/api");
|
||||
const { localDate } = require("../../utils/date");
|
||||
Page({
|
||||
data: {
|
||||
pets: [],
|
||||
@@ -20,7 +21,7 @@ Page({
|
||||
secure("/me"),
|
||||
]);
|
||||
const chosen = wx.getStorageSync("walk_pet_ids") || [],
|
||||
month = new Date().toISOString().slice(0, 7);
|
||||
month = localDate().slice(0, 7);
|
||||
this.setData({
|
||||
pets,
|
||||
selected: chosen.filter((id) => pets.some((p) => p.id === id)),
|
||||
@@ -50,14 +51,14 @@ Page({
|
||||
wx.redirectTo({ url: "/pages/tasks/tasks" });
|
||||
},
|
||||
goWalks() {
|
||||
wx.redirectTo({ url: "/pages/walk/walk" });
|
||||
wx.navigateTo({ url: "/pages/walk-records/walk-records" });
|
||||
},
|
||||
async complete(e) {
|
||||
const id = e.currentTarget.dataset.id,
|
||||
task = this.data.tasks.find((t) => t.id === id);
|
||||
try {
|
||||
await secure("/tasks/" + id + "/completion", "PUT", {
|
||||
date: new Date().toLocaleDateString("sv-SE"),
|
||||
date: localDate(),
|
||||
completed: !task.completed,
|
||||
});
|
||||
await this.load();
|
||||
|
||||
Reference in New Issue
Block a user