add service of platform
This commit is contained in:
1 parent
f805eaaa1e
commit
ee5e1ff1b9
4 files changed
+45
-8
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import i18n, { t } from '../i18n';
|
||||
import { t } from '../i18n';
|
||||
|
||||
export default {
|
||||
path: '/content',
|
||||
|
||||
@@ -2,30 +2,30 @@ import httpClient from '../instance';
|
||||
import { IArticle } from './types';
|
||||
|
||||
class ArticleService {
|
||||
name = 'articles';
|
||||
key = 'articles';
|
||||
|
||||
getAll(): Promise<IArticle> {
|
||||
return httpClient.get(`/${this.name}`);
|
||||
return httpClient.get(`/${this.key}`);
|
||||
}
|
||||
|
||||
get(id: number): Promise<IArticle> {
|
||||
return httpClient.get(`/${this.name}/${id}`);
|
||||
return httpClient.get(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
create(data: IArticle): Promise<IArticle> {
|
||||
return httpClient.post(`/${this.name}`, data);
|
||||
return httpClient.post(`/${this.key}`, data);
|
||||
}
|
||||
|
||||
update(id: number, data: IArticle): Promise<IArticle> {
|
||||
return httpClient.put(`/${this.name}/${id}`, data);
|
||||
return httpClient.put(`/${this.key}/${id}`, data);
|
||||
}
|
||||
|
||||
delete(id: number): Promise<IArticle> {
|
||||
return httpClient.delete(`/${this.name}/${id}`);
|
||||
return httpClient.delete(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
deleteAll(): Promise<IArticle> {
|
||||
return httpClient.delete(`/${this.name}`);
|
||||
return httpClient.delete(`/${this.key}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import httpClient from '../instance';
|
||||
import { IPlatform } from './types';
|
||||
|
||||
class PlatformService {
|
||||
key = 'articles';
|
||||
|
||||
getAll(): Promise<IPlatform> {
|
||||
return httpClient.get(`/${this.key}`);
|
||||
}
|
||||
|
||||
get(id: number): Promise<IPlatform> {
|
||||
return httpClient.get(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
create(data: IPlatform): Promise<IPlatform> {
|
||||
return httpClient.post(`/${this.key}`, data);
|
||||
}
|
||||
|
||||
update(id: number, data: IPlatform): Promise<IPlatform> {
|
||||
return httpClient.put(`/${this.key}/${id}`, data);
|
||||
}
|
||||
|
||||
delete(id: number): Promise<IPlatform> {
|
||||
return httpClient.delete(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
deleteAll(): Promise<IPlatform> {
|
||||
return httpClient.delete(`/${this.key}`);
|
||||
}
|
||||
}
|
||||
|
||||
export default new PlatformService();
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface IPlatform {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
}
|
||||
Reference in new issue
Block a user