Skip to content

Commit

Permalink
Feat: Added Delete Task
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianCB committed Nov 21, 2022
1 parent f0f9282 commit 0dfd66d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/screens/delete-tasks/delete-tasks.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class DeleteTasksComponent implements OnInit {
}).then(async (result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
console.log('Deleting...');
await this.fs.deleteTask(task['id']);
await this.getData();
}
});
Expand Down
9 changes: 6 additions & 3 deletions src/app/services/firebase.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { getFirestore,
query,
collection,
where,
updateDoc } from 'firebase/firestore';
updateDoc,
deleteDoc } from 'firebase/firestore';

@Injectable({
providedIn: 'root'
Expand Down Expand Up @@ -65,8 +66,10 @@ export class FirebaseService {
}

async updateTask(task: any) {

await updateDoc(doc(this.db, "tasks", task['id']), task);
console.log('Cambio existoso');
}

async deleteTask(id: string) {
await deleteDoc(doc(this.db, "tasks", id));
}
}

0 comments on commit 0dfd66d

Please sign in to comment.