Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
puzansakya committed Mar 2, 2019
1 parent 9899c45 commit d97ff27
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class App {

constructor() {
// change the database environment here
Model.knex(Knex(objection.development));
Model.knex(Knex(objection.production));

this.httpFlush = new HttpFlush();
this.express = express();
Expand Down
12 changes: 6 additions & 6 deletions src/app/core/services/article.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ export class ArticleService {

getArticles(page: number): Observable<Articles> {
return this.http
.get<Articles>(`http://localhost:3000/api/v1/articles?page=${page}&limit=12&sort=id&order=desc`)
.get<Articles>(`https://medium-puzan.herokuapp.com/api/v1/articles?page=${page}&limit=12&sort=id&order=desc`)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}

getArticlesByAuthor(authorId: number): Observable<Articles> {
return this.http
.get<Articles>(`http://localhost:3000/api/v1/articles/author/${authorId}`)
.get<Articles>(`https://medium-puzan.herokuapp.com/api/v1/articles/author/${authorId}`)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}

getBookmarkedArticles(authorId: number): Observable<Articles> {
return this.http
.get<Articles>(`http://localhost:3000/api/v1/articles/bookmark/${authorId}`)
.get<Articles>(`https://medium-puzan.herokuapp.com/api/v1/articles/bookmark/${authorId}`)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}

getArticle(slug: string): Observable<Article> {
return this.http
.get<Article>(`http://localhost:3000/api/v1/articles/${slug}`)
.get<Article>(`https://medium-puzan.herokuapp.com/api/v1/articles/${slug}`)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}

Expand All @@ -50,13 +50,13 @@ export class ArticleService {
formdata.append('content', payload.article.content);

return this.http
.post<Article>(`http://localhost:3000/api/v1/articles`, formdata)
.post<Article>(`https://medium-puzan.herokuapp.com/api/v1/articles`, formdata)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}

bookmarkArticle(article: Article) {
return this.http
.post<Article>(`http://localhost:3000/api/v1/articles/bookmark`, article)
.post<Article>(`https://medium-puzan.herokuapp.com/api/v1/articles/bookmark`, article)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}
}
6 changes: 3 additions & 3 deletions src/app/core/services/category.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ export class CategoryService {

getCategory(): Observable<ResponseWrapper<Category>> {
return this.http
.get<ResponseWrapper<Category>>(`http://localhost:3000/api/v1/categories?limit=30`)
.get<ResponseWrapper<Category>>(`https://medium-puzan.herokuapp.com/api/v1/categories?limit=30`)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}

createCategory(payload: Category): Observable<Category> {
return this.http
.post<Category>(`http://localhost:3000/api/v1/categories`, payload)
.post<Category>(`https://medium-puzan.herokuapp.com/api/v1/categories`, payload)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}

updateCategory(payload: Category): Observable<Category> {
return this.http
.put<Category>(`http://localhost:3000/api/v1/categories/${payload.id}`, payload)
.put<Category>(`https://medium-puzan.herokuapp.com/api/v1/categories/${payload.id}`, payload)
.pipe(catchError((error: any) => Observable.throw(error.json())));
}
}

0 comments on commit d97ff27

Please sign in to comment.