mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-24 07:15:24 -07:00
Webhook Editor
This commit is contained in:
parent
55a191b454
commit
5afa928f58
1 changed files with 33 additions and 42 deletions
|
@ -50,52 +50,43 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ReadWebhook } from "~/lib/api/types/household";
|
import type { ReadWebhook } from "~/lib/api/types/household";
|
||||||
import { timeLocalToUTC, timeUTCToLocal } from "~/composables/use-group-webhooks";
|
import { timeLocalToUTC, timeUTCToLocal } from "~/composables/use-group-webhooks";
|
||||||
|
|
||||||
export default defineNuxtComponent({
|
const props = defineProps<{
|
||||||
props: {
|
webhook: ReadWebhook;
|
||||||
webhook: {
|
}>();
|
||||||
type: Object as () => ReadWebhook,
|
|
||||||
required: true,
|
const emit = defineEmits<{
|
||||||
},
|
delete: [id: string];
|
||||||
|
save: [webhook: ReadWebhook];
|
||||||
|
test: [id: string];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const i18n = useI18n();
|
||||||
|
const itemUTC = ref<string>(props.webhook.scheduledTime);
|
||||||
|
const itemLocal = ref<string>(timeUTCToLocal(props.webhook.scheduledTime));
|
||||||
|
|
||||||
|
const scheduledTime = computed({
|
||||||
|
get() {
|
||||||
|
return itemLocal.value;
|
||||||
},
|
},
|
||||||
emits: ["delete", "save", "test"],
|
set(v: string) {
|
||||||
setup(props, { emit }) {
|
itemUTC.value = timeLocalToUTC(v);
|
||||||
const i18n = useI18n();
|
itemLocal.value = v;
|
||||||
const itemUTC = ref<string>(props.webhook.scheduledTime);
|
|
||||||
const itemLocal = ref<string>(timeUTCToLocal(props.webhook.scheduledTime));
|
|
||||||
|
|
||||||
const scheduledTime = computed({
|
|
||||||
get() {
|
|
||||||
return itemLocal.value;
|
|
||||||
},
|
|
||||||
set(v: string) {
|
|
||||||
itemUTC.value = timeLocalToUTC(v);
|
|
||||||
itemLocal.value = v;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const webhookCopy = ref({ ...props.webhook });
|
|
||||||
|
|
||||||
function handleSave() {
|
|
||||||
webhookCopy.value.scheduledTime = itemLocal.value;
|
|
||||||
emit("save", webhookCopy.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set page title using useSeoMeta
|
|
||||||
useSeoMeta({
|
|
||||||
title: i18n.t("settings.webhooks.webhooks"),
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
webhookCopy,
|
|
||||||
scheduledTime,
|
|
||||||
handleSave,
|
|
||||||
itemUTC,
|
|
||||||
itemLocal,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const webhookCopy = ref({ ...props.webhook });
|
||||||
|
|
||||||
|
function handleSave() {
|
||||||
|
webhookCopy.value.scheduledTime = itemLocal.value;
|
||||||
|
emit("save", webhookCopy.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set page title using useSeoMeta
|
||||||
|
useSeoMeta({
|
||||||
|
title: i18n.t("settings.webhooks.webhooks"),
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue