@jdubray my another attempt using SAM to build webapp :relieved:
https://github.com/imnutz/dashboard
In this, I tried to split the webapp into folders and components.
May you take a look?
model.fetchingData = function() {
callRestAPI({})
.then(function(response) {
- update model's data
- call State.render
})
}
model.updateContact = function() {
callRestAPI({})
.then(function(response) {
- update model's data
- call State.render
})
}
// same for create and delete
// server side
$.post( "http://localhost:5425/app/v1/present", data)
.done(function( representation ) {
$( "#representation" ).html( representation );
}
);
var actions = {} ;
actions.edit = function(data) {
data.lastEdited = {title: data.title, description: data.description, id: data.id } ;
present(data) ;
return false ;
} ;
actions.save = function(data) {
data.item = {title: data.title, description: data.description, id: data.id || null} ;
present(data) ;
return false ;
} ;
actions.delete = function(data) {
data = {deletedItemId: data.id} ;
present(data) ;
return false ;
} ;
actions.cancel = function(data) {
present(data) ;
return false ;
} ;