mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-05-20 03:53:44 +00:00
Created basic viewing pages in angular
Can now search and view tournaments. Can now view team scores, weights and seeds, mats and bout board
This commit is contained in:
47
frontend/app/js/services/tournaments-service.js
Normal file
47
frontend/app/js/services/tournaments-service.js
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
app.factory('tournamentsService', tournamentsService);
|
||||
|
||||
function tournamentsService($http){
|
||||
var service = {};
|
||||
|
||||
|
||||
|
||||
service.getAllTournaments = function(){
|
||||
return $http({
|
||||
url: '/api/tournaments/',
|
||||
method: "GET"
|
||||
}).then(successResponse, errorCallback);
|
||||
};
|
||||
|
||||
service.searchTournaments = function(search){
|
||||
return $http({
|
||||
method: 'GET',
|
||||
url: '/api/tournaments/',
|
||||
params: {
|
||||
search: search
|
||||
}
|
||||
}).then(successResponse, errorCallback);
|
||||
};
|
||||
|
||||
service.tournamentDetails = function(tournamentId){
|
||||
return $http({
|
||||
url: '/api/tournaments/' + tournamentId,
|
||||
method: "GET"
|
||||
}).then(successResponse, errorCallback);
|
||||
};
|
||||
|
||||
function successResponse(response){
|
||||
console.log("success log below");
|
||||
console.log(response);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
function errorCallback(err){
|
||||
console.log("error log below");
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user