From 51f0dbce320d9a3ca822bb9982c8cbc25070d744 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Fri, 25 Sep 2020 03:38:53 -0700 Subject: [PATCH] Update api.tsx Add resource to check whether usernames and emails exist --- src/utils/api.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/api.tsx b/src/utils/api.tsx index dd8dfed5..79eb9810 100644 --- a/src/utils/api.tsx +++ b/src/utils/api.tsx @@ -45,11 +45,17 @@ class Api { } as EndpointMap } - search(query: string) { const resourceUrl = `${this.url}/${name}` return axios.get(`${resourceUrl}/search?query=${query}`) } + + check(resource: string, value: string) { + const resourceUrl = `${this.url}/check/${resource}` + return axios.post(resourceUrl, { + [resource]: value + }) + } } const api: Api = new Api({ url: process.env.SIERO_API_URL || 'http://127.0.0.1:3000/api/v1' })