Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c42663 commit 00423dfCopy full SHA for 00423df
modules/Project/ProjectObject.js
@@ -0,0 +1,29 @@
1
+module = angular.module('App.Project')
2
+module.factory('ProjectObject', (BaseObject, $http) => {
3
+ class Project extends BaseObject {
4
+ static list(userId) {
5
+ return $http.get('/api/projects', { params: { user_id: userId } })
6
+ .then( (response) => response.data.map( project => new Project(project) ) );
7
+ }
8
+
9
+ static get(id) {
10
+ return $http.get(`/api/projects/${id}`)
11
+ .then( (response) => new Project(response.data));
12
13
14
15
+ create() {
16
+ return $http.post('/api/projects', this )
17
+ .then( (response) => {
18
+ this.id = response.data.id;
19
+ return response.data;
20
+ });
21
22
23
+ update() {
24
+ return $http.put(`/api/projects/${this.id}`, this);
25
26
27
28
+ return Project;
29
+});
0 commit comments