+
- {{ api?.title }}
+ {{ document?.title }}
-
- {{ api?.request?.method }}
+
+
+
+ {{ document?.api?.title }}
+
+
+ {{ document?.api?.request?.method }}
@@ -12,12 +17,13 @@
@@ -30,4 +42,13 @@ export default {
.header {
padding: 0;
}
+
+.main {
+ .left {
+ float: left;
+ width: 280px;
+ height: 100%;
+ box-shadow: 1px 0 0 #eee;
+ }
+}
diff --git a/src/operators/document/index.ts b/src/operators/document/index.ts
new file mode 100644
index 00000000..4a6cbae5
--- /dev/null
+++ b/src/operators/document/index.ts
@@ -0,0 +1,2 @@
+export * from './models';
+export * from './operator';
diff --git a/src/operators/document/models.ts b/src/operators/document/models.ts
new file mode 100644
index 00000000..161472b9
--- /dev/null
+++ b/src/operators/document/models.ts
@@ -0,0 +1,20 @@
+import { IApi } from '../api/models';
+
+export interface IDocument {
+ id?: string;
+ name?: string;
+ type: 'API' | 'TEXT';
+ title?: string;
+ content?: string;
+ rank?: number;
+ api?: IApi;
+ created_at?: string;
+ updated_at?: string;
+}
+
+export interface IDocumentListResponse {
+ count: number;
+ items: IDocument[];
+}
+
+export type IDocumentDetailResponse = IDocument;
diff --git a/src/operators/document/operator.ts b/src/operators/document/operator.ts
new file mode 100644
index 00000000..5598be91
--- /dev/null
+++ b/src/operators/document/operator.ts
@@ -0,0 +1,36 @@
+import { AxiosResponse } from 'axios';
+import { httpClient } from '../instance';
+import { IDocument, IDocumentDetailResponse, IDocumentListResponse } from './models';
+
+export interface IDocumentQuery {
+ limit: number;
+ offset: number;
+}
+
+class DocumentOperator {
+ key = 'documents';
+
+ async getAll(query: IDocumentQuery): Promise
> {
+ return await httpClient.get(`/${this.key}/`, {
+ params: query
+ });
+ }
+
+ async get(id: string): Promise> {
+ return await httpClient.get(`/${this.key}/${id}`);
+ }
+
+ async create(data: IDocument): Promise> {
+ return await httpClient.post(`/${this.key}/`, data);
+ }
+
+ async update(id: string, data: IDocument): Promise> {
+ return await httpClient.put(`/${this.key}/${id}`, data);
+ }
+
+ async delete(id: string): Promise> {
+ return await httpClient.delete(`/${this.key}/${id}`);
+ }
+}
+
+export const documentOperator = new DocumentOperator();
diff --git a/src/operators/index.ts b/src/operators/index.ts
index c76685ec..9f6c47dc 100644
--- a/src/operators/index.ts
+++ b/src/operators/index.ts
@@ -4,3 +4,4 @@ export * from './auth';
export * from './service';
export * from './user';
export * from './api';
+export * from './document';
diff --git a/src/pages/document/Detail.vue b/src/pages/document/Detail.vue
index 657ad6cc..d1449be6 100644
--- a/src/pages/document/Detail.vue
+++ b/src/pages/document/Detail.vue
@@ -1,42 +1,38 @@
-
-
-
-
-
-
-
+
+
diff --git a/src/pages/document/Index.vue b/src/pages/document/Index.vue
index ef591a41..c6119b3a 100644
--- a/src/pages/document/Index.vue
+++ b/src/pages/document/Index.vue
@@ -1,50 +1,32 @@
-
-
-
-
-
{{ $t('common.title.documentIntroduction') }}
-
-
-
+
+
{{ $t('common.title.documentIntroduction') }}
+