summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/api/users.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-07 14:04:28 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-10 12:14:50 +0200
commitd889a41487c1312ed11deb7e88f0214ac057727c (patch)
treefd07a4ea0b64e1260b8be6f57e018b88bb579bd5 /opendc-web/opendc-web-ui/src/api/users.js
parent2c739c4fdb5aab1d1d4480d4e233a1174bc85494 (diff)
feat(web/ui): Show monthly simulation budget in UI
This change updates the OpenDC web UI to show the monthly simulation budget of the user in the user dropdown. This provides the user with a progress bar of the used simulation minutes.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/api/users.js')
-rw-r--r--opendc-web/opendc-web-ui/src/api/users.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-ui/src/api/users.js b/opendc-web/opendc-web-ui/src/api/users.js
new file mode 100644
index 00000000..12a9be05
--- /dev/null
+++ b/opendc-web/opendc-web-ui/src/api/users.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+import { request } from './index'
+
+/**
+ * Fetch information about the user from the web server.
+ *
+ * @param auth The authentication object.
+ */
+export function fetchUser(auth) {
+ return request(auth, `users/me`)
+}