aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-08-22 12:21:02 -0700
committerAdam Soltys <[email protected]>2022-08-22 12:21:02 -0700
commit0363a216681b22c2d0af07dd596d60c90ddec69b (patch)
treecbc30c0174b811ca746f0abaea3f651b7d0a7b93 /src/lib/utils.js
parent69b088cf2fa207ef90d94a424e407fd354c4c5a9 (diff)
downloadcoinos-ui-0363a216681b22c2d0af07dd596d60c90ddec69b.tar.gz
coinos-ui-0363a216681b22c2d0af07dd596d60c90ddec69b.zip
update user with put request
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js11
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!');