This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-15
lines changed
Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -35,22 +35,13 @@ export default class TDSClient {
3535 return await TypeManager . getToday ( ) ;
3636 }
3737
38- /** 🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈Implement thiss"""🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈
39- * Method for find a todoist resource by type (task, project, etc.) using its ID.
40- * The resource type is given by params.
41- * Returns the name/content of the resource specified
42- */
43- async findByID ( { type = "task" , id } = { } ) {
44- const TypeManager = new IManager ( type , this . headers ) ;
45- return await TypeManager . findById ( id ) ;
46- }
47-
4838 /**
4939 * Method for creating todoist resources (task, project, etc.). The resource type ond object are given by params.
5040 * If no params, creates a NO_CONTENT task
41+ * Returns true if all ok, then false.
5142 */
5243 create ( { type = "task" } = { } , ObjectFromType ) {
5344 const TypeManager = new IManager ( type , this . headers ) ;
54- TypeManager . create ( ObjectFromType ) ;
45+ return TypeManager . create ( ObjectFromType ) ;
5546 }
5647}
Original file line number Diff line number Diff line change @@ -7,10 +7,13 @@ export default class ProjectsManager {
77 }
88
99 create ( project = new Project ( ) ) {
10- axios
10+ return axios
1111 . post ( `https://api.todoist.com/rest/v1/projects` , project , this . headers )
1212 . then ( ( ) => true )
13- . catch ( ( err ) => console . error ( err ) ) ;
13+ . catch ( ( err ) => {
14+ console . log ( err ) ;
15+ return false ;
16+ } ) ;
1417 }
1518
1619 /**
Original file line number Diff line number Diff line change @@ -7,9 +7,13 @@ export default class TasksManager {
77 }
88
99 create ( task = new Task ( ) ) {
10- axios
10+ return axios
1111 . post ( `https://api.todoist.com/rest/v1/tasks` , task , this . headers )
12- . then ( ( ) => true ) ;
12+ . then ( ( ) => true )
13+ . catch ( ( err ) => {
14+ console . log ( err ) ;
15+ return false ;
16+ } ) ;
1317 }
1418
1519 /**
You can’t perform that action at this time.
0 commit comments