Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace all confirms with Qusar Dialogs #8

Open
mr-zwets opened this issue May 5, 2024 · 1 comment
Open

replace all confirms with Qusar Dialogs #8

mr-zwets opened this issue May 5, 2024 · 1 comment

Comments

@mr-zwets
Copy link
Member

mr-zwets commented May 5, 2024

Replace all confirms with Quasar Dialogs. There are 5 generic confirms in the codebase.

@jimtendo
Copy link
Contributor

jimtendo commented Aug 4, 2024

This should be pretty easily actually.

I'd recommend using the Plugin version of Dialog here:

https://quasar.dev/quasar-plugins/dialog

You might want to create a Util so that you can call it synchronously (as opposed to nesting callbacks). Something like:

import { Dialog } from 'quasar';

export async function confirmDialog(message: string, title?: string) {
  return new Promise<boolean>((resolve, reject) => {
	Dialog.create({
	  title,
	  message
	}).onOk(() => {
	  resolve(true);
	}).onCancel(() => {
	  resolve(false);
	}).onDismiss(() => {
	  resolve(false)
	})
  }
}

... this way, you should be able to leverage like so:

// If user does not confirm, return to prevent further execution.
if (!await confirmDialog('Are you sure you want to...')) {
  return;
}

(DON'T FORGET TO ADD Dialog AS A PLUGIN IN quasar.conf.js as per instructions in link!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants