client_src/api/ListsService.js
/**
  * add the elemento on the server
  * on succes, success will be call with the json body passed as arg to the succes function
  * on error the error will be call with the error
  */
add the elemento on the server
on succes, success will be call with the json body passed as arg to the succes function
on error the error will be call with the error
add the elemento on the server on succes success will be call with the json body passed as arg to the succes function on error the error will be call with the error
addList(listName,listDescription,success,error){
    let body={
      method: 'POST',
      body: `{"name":"${listName}","description":"${listDescription}"}`,
      headers:{"Content-Type": "application/json"}
    };
    let req= new Request('/lists',body);
    fetch(req)
    .then(response=>{
      response.json().then(json=>{
        success(json);
      })
    })
    .catch(error=>{error(error)})
  }
addList ( listName , listDescription , success , error ) { let body = { method : 'POST' , body : ` ${ listName } ${ listDescription } ` , headers : { "Content-Type" : "application/json" } } ; let req = new Request ( '/lists' , body ) ; fetch ( req ) . then ( response => { response . json ( ) . then ( json => { success ( json ) ; } ) } ) . catch ( error => { error ( error ) } ) }
add the elemento on the server
 on succes, success will be call with the json body passed as arg to the succes function
 on error the error will be call with the error
add the elemento on the server on succes success will be call with the json body passed as arg to the succes function on error the error will be call with the error