From 3fb92531d7b73497734be9cb3cdebb4ef4932412 Mon Sep 17 00:00:00 2001
From: Alberto Defendi <1369-ahl-berto@users.noreply.gitlab.inf.unibz.it>
Date: Sun, 6 Jun 2021 08:09:17 +0200
Subject: [PATCH] Add data options.

---
 src/api/ResponseProps.ts | 9 +++++++++
 src/api/getSeniorList.ts | 7 +++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 src/api/ResponseProps.ts

diff --git a/src/api/ResponseProps.ts b/src/api/ResponseProps.ts
new file mode 100644
index 0000000..4580309
--- /dev/null
+++ b/src/api/ResponseProps.ts
@@ -0,0 +1,9 @@
+export type ResponseProps = {
+  id: number;
+  user: {
+    email: string;
+    firstName: string;
+    lastName: string;
+    username: string;
+  };
+};
diff --git a/src/api/getSeniorList.ts b/src/api/getSeniorList.ts
index d300c33..239e48e 100644
--- a/src/api/getSeniorList.ts
+++ b/src/api/getSeniorList.ts
@@ -1,4 +1,7 @@
 import axios from 'axios';
+import { ResponseProps } from './ResponseProps';
 
-export const getSeniorList = async (name: string): Promise<string[]> =>
-  axios.get(`/api/web/seniors/by_name/${name}`).then((res) => res.data);
+export const getSeniorList = async (name: string): Promise<ResponseProps[]> =>
+  axios
+    .get(`/api/web/seniors/by_name/${name}?fields=user,id`)
+    .then((res) => res.data);
-- 
GitLab