franius8 / todo-site

Detected the use of alert, confirm and prompt JS-0052
Anti-pattern
Minor
a year agoa year old
Unexpected confirm.
 52
 53    // Function deleting a single project
 54    const deleteProject = ( { iD }: ProjectInterface) => {
 55        if (confirm('Are you sure you want to delete that?\nThis is an irreversible operation\nProject ToDos will be deleted as well.')) { 56            const projectsCopy = [...projects];
 57            const toDosCopy = [...toDoList];
 58            const newProjectsCopy = projectsCopy.filter(x => x.iD !== iD);
Unexpected confirm.
 64
 65    // Function deleting a single done project
 66    const deleteDoneProject = ( { iD }: ProjectInterface) => {
 67        if (confirm('Are you sure you want to delete that?\nThis is an irreversible operation\nProject ToDos will be deleted as well.')) { 68            const doneProjectsCopy = [...doneProjects]
 69            const doneToDosCopy = [...doneToDos]
 70            const newDoneProjectsCopy = doneProjectsCopy.filter(x => x.iD !== iD)
Unexpected confirm.
40
41    // Function for deleting a single ToDo element
42    const deleteToDo = (iD: number) => {
43        if (confirm('Are you sure you want to delete that?\n(This is an irreversible operation)')) {44            const toDosCopy = [...toDoList].filter(x => x.iD !== iD);
45            dispatch(setToDos(toDosCopy));
46        }
Unexpected confirm.
15    // Function to delete a signle done ToDo
16    const deleteToDo = ( { iD }:ToDoInterface ) => {
17        
18        if (confirm('Are you sure you want to delete that?\n(This is an irreversible operation)')) {19            const doneToDosCopy = [...doneToDos].filter(x => x.iD !== iD);
20            
21            dispatch(setDoneList(doneToDosCopy));
32                updateProfile(user, {
33                    displayName: name
34                }).then(() => {
35                   alert("User registered successfully");36                }).catch((error) => {
37                    // An error occurred
38                    // ...