Replace fetch with Axios in client
Replace `.then` with await syntax where possible.
GitLab: #142
Change-Id: I6c132f49f152afa7e20919a1c70c539f2ad54878
diff --git a/client/src/App.tsx b/client/src/App.tsx
index c202c37..f5c36a7 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -15,6 +15,7 @@
* License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
+import axios from 'axios';
import { useState } from 'react';
import { json, LoaderFunctionArgs, Outlet, redirect } from 'react-router-dom';
@@ -22,10 +23,10 @@
import { apiUrl } from './utils/constants';
export async function checkSetupStatus(): Promise<boolean> {
- const url = new URL('/setup/check', apiUrl);
- const response = await fetch(url);
- const { isSetupComplete } = await response.json();
- return isSetupComplete;
+ const { data } = await axios.get('/setup/check', {
+ baseURL: apiUrl,
+ });
+ return data.isSetupComplete;
}
export async function appLoader({ request }: LoaderFunctionArgs) {