Skip to content
Snippets Groups Projects

fixed sqlite3 news_id -1 issue

+ 8
4
Compare changes
  • Side-by-side
  • Inline
@@ -49,10 +49,14 @@
function submitNews(){
vm.info.project_id = (vm.info.restricted == 'Y') ? Authentication.currentUser.project_id : null;
delete vm.info['restricted'];
if(vm.info.news_id == -1) News.news.post(vm.info).then(function(){
toastr.success('News created successfuly','success');
$location.path("/news");
});
if(vm.info.news_id == -1) {
//delete the news_id value of -1 as it breaks sqlite3 db
delete vm.info['news_id'];
News.news.post(vm.info).then(function(){
toastr.success('News created successfuly','success');
$location.path("/news");
});
}
else vm.info.save().then(function(){
toastr.success('News updated successfuly','success');
$location.path("/news");
Loading