From ea018c56c668dfa208dbda184c744f24f7b9046c Mon Sep 17 00:00:00 2001
From: Alberto Defendi <1369-ahl-berto@users.noreply.gitlab.inf.unibz.it>
Date: Sun, 23 May 2021 12:05:18 +0200
Subject: [PATCH] Set role call.

---
 src/api/setRole.ts | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 src/api/setRole.ts

diff --git a/src/api/setRole.ts b/src/api/setRole.ts
new file mode 100644
index 0000000..7dd8331
--- /dev/null
+++ b/src/api/setRole.ts
@@ -0,0 +1,8 @@
+import axios from 'axios';
+
+/**
+ * Ask the server all the roles of an user (if the user has multiple roles).
+ * @returns array of roles.
+ */
+export const setRole = async (role: string): Promise<void> =>
+  axios.post('/api/web/login/set_role', { role });
-- 
GitLab