diff options
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 11 |
1 files changed, 10 insertions, 1 deletions
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!'); |
