aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
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
commitbc77cf10532a4060d97b0f804111b4f582151120 (patch)
treef23259596158764da10c0b4e3bf954e97118d35c /src/lib
parent47873912ae85ab99a4fd462c2cb1541e9ceff316 (diff)
downloadcoinos-ui-bc77cf10532a4060d97b0f804111b4f582151120.tar.gz
coinos-ui-bc77cf10532a4060d97b0f804111b4f582151120.zip
update user with put request
Diffstat (limited to 'src/lib')
-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!');