Last active
February 23, 2017 16:47
-
-
Save emolr/7c48f2d50ebbef5bdce0482ddb432f4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // article-form.backend.ts | |
| import {Injectable} from "@angular/core"; | |
| import {IArticle} from "./article-form.interface"; | |
| @Injectable() | |
| export class ArticleFormBackend { | |
| constructor( | |
| // Pass your client here (http, apollo etc..) | |
| ) {} | |
| public create(payload: IArticle): Promise<any> { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve({ | |
| data: payload, | |
| message: 'Create was successful' | |
| }); | |
| }, 1000); | |
| }) | |
| } | |
| public update(payload: IArticle): Promise<any> { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve({ | |
| data: payload, | |
| message: 'Update was successful' | |
| }); | |
| }, 1000); | |
| }) | |
| } | |
| public delete(payload: IArticle): Promise<any> { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve({ | |
| data: payload, | |
| message: 'Delete was successful' | |
| }); | |
| }, 1000); | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment