question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dialog never enter the confirm method

See original GitHub issue

Hi,

We’re having issues with your plugin. We’re using it with the <script> include and, following the documentation, we declare

window.Vue.use(VuejsDialog.default);

Here is our code

this.$dialog.confirm('Confirm delete', {
                loader: true,
                okText: 'Yes',
                cancelText: 'No'
            })
                .then(function (dialog) {
                    console.log('confirm');
                    dialog.close();
                });

The code never enters the then function and it throws a message in the console :

Possible Unhandled Promise Rejection: undefined

We tried without the loader, same error.

Thanks 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
danchanncommented, Jun 18, 2018

@Godofbrowser Got it, had to go the v-confirm way to get it working.

                               <button 
                                class="btn btn-danger btn-sm"
                                v-confirm="{
                                    loader: true,
                                    ok: dialog => removeMenuItem(dialog, item['.key']),
                                    cancel: doNothing,
                                    message: 'Are you sure you want to delete?'
                                }"
                                >X</button>
        removeMenuItem(dialog, key) {
            dbMenuRef.child(key).remove()
                .then((error) => {
                    dialog.close()
                    console.log("Remove succeeded")
                })
                .catch((error) => {
                    console.log("Remove failed: " + error.message)
                })
        },
1reaction
danchanncommented, Jun 18, 2018

Got the following errors:

  1. Remove failed: dialog.close is not a function
  2. Remove failed: Cannot read property ‘$dialog’ of undefined
methods: {
        removeMenuItem(key) {
            this.$dialog.confirm('Are you sure you want to delete?')
            .then(function(dialog) {
                dbMenuRef.child(key).remove()
                    .then(function(error) {
                        this.$dialog.close()
                        console.log("Remove succeeded")
                    })
                    .catch(function(error){
                        console.log("Remove failed: " + error.message)
                    })
                // this.getMenuItems.splice(this.getMenuItems.indexOf(item), 1);
                console.log(' Clicked on continue')
                // this.$dialog.close()
            })
            .catch(function (error) {
                console.log(`Clicked on cancel ${error}`)
            });
        },

have already tried your above syntax as well.l

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use Confirm Dialogs in JavaScript - Shahed Nasser
In this tutorial, we'll learn how to use confirm() and how to show confirmation dialog before the user leaves the page.
Read more >
javascript - confirmation dialog isn't showing - Stack Overflow
I'd like to request a review/bashing of this circuit for a high precision soil moisture sensing and analysis device. Where did I go...
Read more >
Confirm Yes or No With JavaScript - Code - Envato Tuts+
There are some drawbacks of using the confirm method to get user confirmation. One is that the confirmation dialog will not be part...
Read more >
Need Help with Confirm Dialog - ServiceNow Community
I am writing a client script, which is supposed to give a confirmation dialog having 'Ok' & 'Cancel' buttons when the category of...
Read more >
need help with FORM.confirm - Google Groups
The dialog simply does not pop up and never enters the if form.accepted clause. Looking at the pages source does not show up...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found