mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-05-08 23:11:00 +00:00
Added a search to both api and frontend
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
app.factory('tournamentsService', function($http){
|
||||
|
||||
|
||||
|
||||
return {
|
||||
getAllTournaments: function() {
|
||||
//since $http.get returns a promise,
|
||||
@@ -10,6 +10,24 @@ app.factory('tournamentsService', function($http){
|
||||
return $http.get('/api/tournaments/').then(function(result) {
|
||||
return result.data;
|
||||
});
|
||||
},
|
||||
|
||||
searchTournaments: function(search){
|
||||
return $http({
|
||||
method: 'GET',
|
||||
url: '/api/tournaments/',
|
||||
params: {
|
||||
search: search
|
||||
}
|
||||
}).then(function successCallback(response) {
|
||||
// this callback will be called asynchronously
|
||||
// when the response is available
|
||||
return response.data
|
||||
}, function errorCallback(response) {
|
||||
// called asynchronously if an error occurs
|
||||
// or server returns response with an error status.
|
||||
return response;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user