nuxt-spring-boot-showcase/frontend/app/ui.ts
2025-11-19 20:22:22 -06:00

30 lines
752 B
TypeScript

import ConfirmationModal from "./components/ConfirmationModal.vue";
import type { Runnable } from "./types";
// A sample global state of the web app
export class AppState {
constructor(public time: Date) {}
}
export interface NavRoute {
title: string;
path: string;
}
export interface ConfirmationDialog {
show(message: string, onSuccess: Runnable): void;
}
export const confirmationDialog: () => ConfirmationDialog = () => {
const overlay = useOverlay();
const modal = overlay.create(ConfirmationModal);
return {
async show(message: string, onSuccess: Runnable) {
const instance = modal.open({ message: message });
const result = await instance.result;
if (result) {
onSuccess();
}
},
};
};