Skip to content

Instantly share code, notes, and snippets.

@emolr
Last active February 23, 2017 16:47
Show Gist options
  • Select an option

  • Save emolr/7c48f2d50ebbef5bdce0482ddb432f4b to your computer and use it in GitHub Desktop.

Select an option

Save emolr/7c48f2d50ebbef5bdce0482ddb432f4b to your computer and use it in GitHub Desktop.
// 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