aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/apis/google_docs/GoogleApiClientUtils.ts11
-rw-r--r--src/client/views/MainView.tsx6
2 files changed, 11 insertions, 6 deletions
diff --git a/src/client/apis/google_docs/GoogleApiClientUtils.ts b/src/client/apis/google_docs/GoogleApiClientUtils.ts
index 71e5e1073..5e974b2e7 100644
--- a/src/client/apis/google_docs/GoogleApiClientUtils.ts
+++ b/src/client/apis/google_docs/GoogleApiClientUtils.ts
@@ -110,9 +110,14 @@ export namespace GoogleApiClientUtils {
}
};
- export const Read = async (documentId: string, removeNewlines = false): Promise<Opt<string>> => {
- return Retrieve(documentId).then(schema => {
- return schema ? Utils.extractText(schema, removeNewlines) : undefined;
+ export interface ReadOptions {
+ documentId: string;
+ removeNewlines?: boolean;
+ }
+
+ export const Read = async (options: ReadOptions): Promise<Opt<string>> => {
+ return Retrieve(options.documentId).then(schema => {
+ return schema ? Utils.extractText(schema, options.removeNewlines) : undefined;
});
};
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 3a5285a66..705eacc0c 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -156,9 +156,9 @@ export class MainView extends React.Component {
componentDidMount() {
reaction(() => this.mainContainer, () => {
- let main = this.mainContainer, googleDocId;
- if (main && (googleDocId = StrCast(main.googleDocId))) {
- GoogleApiClientUtils.Docs.Read(googleDocId, true).then(text => {
+ let main = this.mainContainer, documentId;
+ if (main && (documentId = StrCast(main.googleDocId))) {
+ GoogleApiClientUtils.Docs.Read({ documentId }).then(text => {
text && Utils.CopyText(text);
console.log(text);
});