mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 14:54:37 +00:00
Define DialogButton interface locally
This commit is contained in:
@@ -18,13 +18,18 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DialogButton } from '@comfyorg/comfyui-electron-types'
|
||||
import Button from 'primevue/button'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import { electronAPI } from '@/utils/envUtil'
|
||||
|
||||
interface DialogButton {
|
||||
label: string
|
||||
returnValue: string | null
|
||||
severity?: 'primary' | 'secondary' | 'danger' | 'warn'
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
// Get title and message from query parameters
|
||||
@@ -38,8 +43,21 @@ const message = computed(() => {
|
||||
})
|
||||
|
||||
const buttons = computed(() => {
|
||||
// Assertion: Not important enough to justify validation... yet.
|
||||
return JSON.parse(route.query.buttons as string) as DialogButton[]
|
||||
try {
|
||||
const buttonsParam = route.query.buttons
|
||||
if (!buttonsParam || typeof buttonsParam !== 'string') {
|
||||
return []
|
||||
}
|
||||
const parsed = JSON.parse(buttonsParam)
|
||||
if (!Array.isArray(parsed)) {
|
||||
console.error('Invalid buttons parameter: expected array')
|
||||
return []
|
||||
}
|
||||
return parsed as DialogButton[]
|
||||
} catch (error) {
|
||||
console.error('Failed to parse buttons parameter:', error)
|
||||
return []
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user