From 15adf17efa078464643f8bcfd0f8c0b8afea8424 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Mon, 6 Jul 2020 14:27:34 -0700 Subject: moved some API calls over to Dash --- src/client/apis/hypothesis/HypothesisApiUtils.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/client/apis/hypothesis/HypothesisApiUtils.ts (limited to 'src/client/apis/hypothesis') diff --git a/src/client/apis/hypothesis/HypothesisApiUtils.ts b/src/client/apis/hypothesis/HypothesisApiUtils.ts new file mode 100644 index 000000000..714c9cdaf --- /dev/null +++ b/src/client/apis/hypothesis/HypothesisApiUtils.ts @@ -0,0 +1,13 @@ +export namespace Hypothesis { + export const getAnnotation = async (username: String, searchParam: String) => { + const base = 'https://api.hypothes.is/api/search'; + const request = base + `?user=acct:${username}@hypothes.is&text=${searchParam}`; + console.log("DASH Querying " + request); + const response = await fetch(request); + if (response.ok) { + return response.json(); + } else { + throw new Error('DASH: Error in GET request'); + } + }; +} \ No newline at end of file -- cgit v1.2.3-70-g09d2