Skip to content

Commit ca48131

Browse files
authored
Added toast for no tasks to export (#247)
* added toast error for no tasks to export * added an informatory toast * added info toast for no-task-avail
1 parent 2b2709c commit ca48131

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

frontend/src/components/utils/ExportTasks.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { toast } from 'react-toastify';
12
import { Task } from './types';
23

34
export function exportTasksAsJSON(tasks: Task[]) {
45
if (!tasks || tasks.length === 0) {
56
console.warn('No tasks to export.');
7+
toast.info('Tasks list is empty!');
68
return;
79
}
810
const jsonString = JSON.stringify(tasks, null, 2);
@@ -20,6 +22,7 @@ export function exportTasksAsJSON(tasks: Task[]) {
2022
export function exportTasksAsTXT(tasks: Task[]) {
2123
if (!tasks || tasks.length === 0) {
2224
console.warn('No tasks to export.');
25+
toast.info('Tasks list is empty!');
2326
return;
2427
}
2528
let txtContent = 'Your TaskWarrior Tasks\n';

0 commit comments

Comments
 (0)