From 4a5f7b838993be82068cbafdfcde7e8e4b30e5db Mon Sep 17 00:00:00 2001 From: Net Date: Fri, 19 Jul 2024 15:55:15 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=9B=E0=B8=A5=E0=B8=87=20?= =?UTF-8?q?=E0=B9=80=E0=B8=A7=E0=B8=A5=E0=B8=B2=20=20iso?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/04_system/stores/main.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/04_system/stores/main.ts b/src/modules/04_system/stores/main.ts index 39b74b24..9188272b 100644 --- a/src/modules/04_system/stores/main.ts +++ b/src/modules/04_system/stores/main.ts @@ -1,6 +1,7 @@ import { defineStore } from "pinia"; import http from "@/plugins/http"; import config from "@/app.config"; +import moment from "moment"; import { useCounterMixin } from "@/stores/mixin"; @@ -252,12 +253,12 @@ export const useDataStore = defineStore("systemStore", () => { date: convertCronToForm(item.schedule, "date") || "", timeStartEvery: convertCronToForm(item.schedule, "timeStartEvery") || "", - startAt: item.startAt, + startAt: moment(item.startAt) + .utcOffset(7) + .format("YYYY-MM-DD HH:mm"), enabled: item.enabled, }; }); - - console.log(dataSchedule.value); }) .finally(() => { hideLoader(); @@ -280,11 +281,14 @@ export const useDataStore = defineStore("systemStore", () => { }); } - async function editSchedule(data: ScheduleCreate) { + async function editSchedule(id: string, data: ScheduleCreate) { showLoader(); await http - .put(config.API.backup + "/schedule", { - data, + .put(config.API.backup + "/schedule/" + id, { + startAt: data.startAt !== undefined ? data.startAt : undefined, + enabled: data.enabled, + schedule: data.schedule, + name: data.name, }) .then(async (res) => { return res.data;