11<script setup lang='ts'>
2- import type { ToastMessageOptions } from ' primevue/toast'
32import { FormKitSchema } from ' @formkit/vue'
43import { useClipboard } from ' @vueuse/core'
54import { useInputEditor } from ' my-library'
6- import { useToast } from ' primevue/usetoast'
75
86import { ref } from ' vue'
7+ import { useMessages } from ' ../../composables/messages'
98
109const props = defineProps <{
1110 header: string
@@ -18,27 +17,23 @@ const schemaResultFormKey = ref(0)
1817
1918const { editorDataToSchema, editorDataToJson, editorDataToCode } = useInputEditor ()
2019
21- const toast = useToast ()
22-
23- function showMessage(severity : ToastMessageOptions [' severity' ], summary : string , detail : string ) {
24- toast .add ({ severity , summary , detail , life: 2000 })
25- }
20+ const { showSuccessMessage } = useMessages ()
2621
2722const formSchema = ref (props .schema )
2823const formData = reactive (props .data )
2924
3025const data = ref ({})
3126
3227async function submitHandler() {
33- showMessage ( ' success ' , ` Form Input (${formData ._dollar_formkit }) updated ` , ' Input creation completed successfully ...' )
28+ showSuccessMessage ( ` Form Input (${formData ._dollar_formkit }) updated ` , ' Input creation completed successfully ...' )
3429
3530 data .value = { }
3631 schemaResultFormKey .value += 1
3732 Object .assign (formData , { ... formData , schemaResultFormKey: schemaResultFormKey .value })
3833}
3934
4035async function submitHandler2() {
41- showMessage ( ' success ' , ` Data submitted ` , data .value )
36+ showSuccessMessage ( ` Data submitted ` , data .value . toString () )
4237}
4338
4439const schemaResult = computed (() => editorDataToSchema (formData ))
@@ -56,7 +51,6 @@ function copyObject() {
5651
5752<template >
5853 <div >
59- <Toast position =" bottom-right" />
6054 <h2 class =" text-color-[var(--p-primary-color)] pb-2" >
6155 {{ header }}
6256 </h2 >
0 commit comments