From bc77cf10532a4060d97b0f804111b4f582151120 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 22 Aug 2022 12:21:02 -0700 Subject: update user with put request --- src/lib/utils.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/lib/utils.js') diff --git a/src/lib/utils.js b/src/lib/utils.js index 226002e7..3f2f566e 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -22,7 +22,7 @@ export const get = (url, headers = { accept: 'application/json' }) => export const post = (url, body, headers) => { headers = { ...headers, accept: 'application/json', 'content-type': 'application/json' }; return fetch(base + url, { - method: 'POST', + method: "POST", body: JSON.stringify(body), headers }) @@ -41,6 +41,15 @@ export const post = (url, body, headers) => { }); }; +export const put = (url, body, headers) => { + headers = { ...headers, 'content-type': 'application/json' }; + return fetch(base + url, { + method: "PUT", + body: JSON.stringify(body), + headers + }); +}; + export const copy = (text) => { navigator.clipboard.writeText(text); success('Copied!'); -- cgit v1.2.3