-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
The way currently the save in Model is implemented is:
public void save(final VoidCallback callback) {
invokeMethod(id == null ? "create" : "save", toMap(),
new Adapter.JsonObjectCallback() {
@Override
public void onError(Throwable t) {
callback.onError(t);
}
@Override
public void onSuccess(JSONObject response) {
Object id = response.opt("id");
if (id != null) {
setId(id);
}
callback.onSuccess();
}
});
}
Sometimes after saving something to the database you care about getting the JsonResponseObject, like maybe getting the ID for the object saved from the ResponseObject. So I was thinking that we have another save method in the Model class that actually returns a JSONResponseObject like this
public void save(final JsonObjectCallback callback) {
invokeMethod(id == null ? "create" : "save", toMap(),
new Adapter.JsonObjectCallback() {
@Override
public void onError(Throwable t) {
callback.onError(t);
}
@Override
public void onSuccess(JSONObject response) {
Object id = response.opt("id");
if (id != null) {
setId(id);
}
callback.onSuccess(response);
}
});
}
Metadata
Metadata
Assignees
Labels
No labels