web: update restful api

This commit is contained in:
steven
2021-12-09 21:45:48 +08:00
parent b8c01524c5
commit bdaeb3a68b
14 changed files with 75 additions and 178 deletions

View File

@ -117,6 +117,11 @@ class MemoService {
});
}
public async getLinkedMemos(memoId: string): Promise<Model.Memo[]> {
const { memos } = this.getState();
return memos.filter((m) => m.content.includes(memoId));
}
public async createMemo(text: string): Promise<Model.Memo> {
const { data: memo } = await api.createMemo(text);
return memo;
@ -126,11 +131,6 @@ class MemoService {
const { data: memo } = await api.updateMemo(memoId, text);
return memo;
}
public async getLinkedMemos(memoId: string): Promise<Model.Memo[]> {
const { data } = await api.getLinkedMemos(memoId);
return data;
}
}
const memoService = new MemoService();