Fixing case when task not found
This commit is contained in:
parent
24ed50d9d2
commit
d9c2c6f5f6
5 changed files with 14 additions and 12 deletions
|
@ -61,7 +61,7 @@ class ApiController extends Controller
|
|||
$days = ($request->input('days', 15) - 1);
|
||||
|
||||
$task = Task::with(['group'])
|
||||
->find($id)
|
||||
->findOrFail($id)
|
||||
;
|
||||
|
||||
if (! is_null($task)) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -34,16 +34,15 @@
|
|||
getTasks: function() {
|
||||
this.$http.get('/api/getTasks')
|
||||
.then(response => this.$store.commit('setTasks', response.data))
|
||||
.then(() => {
|
||||
this.refreshed_time = this.moment();
|
||||
this.loading.hide()
|
||||
})
|
||||
.catch(error => {
|
||||
this.loading.hide()
|
||||
clearTimeout(this.refresh)
|
||||
window.alert('An error occurred when getting tasks. Automatic refresh has been disabled. You should fix and reload this page.')
|
||||
})
|
||||
this.refreshed_time = this.moment();
|
||||
.then(() => {
|
||||
this.refreshed_time = this.moment();
|
||||
this.loading.hide()
|
||||
})
|
||||
}
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
|
|
|
@ -179,6 +179,9 @@
|
|||
}, 10000)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
//TODO: do something
|
||||
})
|
||||
.then(() => {
|
||||
this.loader.hide()
|
||||
})
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
|
|
||||
*/
|
||||
|
||||
$router->group(['prefix' => 'api/'], function () use ($router) {
|
||||
$router->get('getTasks/', ['uses' => 'ApiController@getTasks']);
|
||||
$router->post('getTask/{id}', ['uses' => 'ApiController@getTaskDetails']);
|
||||
$router->patch('toggleTaskStatus/{id}', ['uses' => 'ApiController@toggleTaskStatus']);
|
||||
$router->group(['prefix' => '/api'], function () use ($router) {
|
||||
$router->get('/getTasks/', ['uses' => 'ApiController@getTasks']);
|
||||
$router->post('/getTask/{id}', ['uses' => 'ApiController@getTaskDetails']);
|
||||
$router->patch('/toggleTaskStatus/{id}', ['uses' => 'ApiController@toggleTaskStatus']);
|
||||
});
|
||||
|
||||
$router->get('/{route:.*}/', function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue