I can't to complete challenge "Get Hands-On with New Alert, Confirm, and Prompt Modules and Components". I'm pretty sure this challenge have a bug and I want to know I made a mistake or this is challenge have bug.
The assignment:
import { LightningElement, api } from "lwc";
export default
class recordCardQuickFiles extends LightningElement {
@api
recordId;
onDeleteAllFilesButtonClick() {
const confirmation = confirm("Are you sure you want to delete all files?");
if (confirmation) {
//... proceed with
//... Apex Logic to delete Files.
//... We will not check this comment.
}
}
}
My solution:
import { LightningElement, api } from "lwc";
import LightningConfirm from "lightning/confirm";
export default
class recordCardQuickFiles extends LightningElement {
@api
recordId;
configs = {
Message: "Are you sure you want to delete all files?",
Label: "Are you sure you want to delete all files?",
Variant: "headerless"
}
onDeleteAllFilesButtonClick() {
const confirmation = LightningConfirm.open(this.configs);
if (confirmation) {
//... proceed with
//... Apex Logic to delete Files.
//... We will not check this comment.
}
}
}
And error occured: Challenge not yet complete in your.org The Message used in the LightningConfirm method is not correct.
The JS file for the LWC should be something like the following:
import { LightningElement, api } from "lwc";
import LightningConfirm from 'lightning/confirm';
export default
class recordCardQuickFiles extends LightningElement {
@api
recordId;
onDeleteAllFilesButtonClick() {
const confirmation = LightningConfirm.open({
Message: 'Are you sure you want to delete all files?',
Variant: 'headerless',
Label: 'Are you sure you want to delete all files?'
});
if (confirmation) {
//... proceed with
//... Apex Logic to delete Files.
//... We will not check this comment.
}
}
}
I hope that helps. Thanks!