Migrate client features to use new server
Remove all authManager references where possible.
Change fetch calls url to new server.
GitLab: #79
GitLab: #100
GitLab: #110
Change-Id: I1dce64108ceba67531372df764f8f7563cc50a3b
diff --git a/client/src/components/UsernameChooser.jsx b/client/src/components/UsernameChooser.jsx
index 486d947..3c1f584 100644
--- a/client/src/components/UsernameChooser.jsx
+++ b/client/src/components/UsernameChooser.jsx
@@ -20,7 +20,7 @@
import { useEffect, useState } from 'react';
import usePromise from 'react-fetch-hook/usePromise';
-import authManager from '../AuthManager';
+import { apiUrl } from '../utils/constants.js';
const isInputValid = (input) => input && input.length > 2;
@@ -30,7 +30,7 @@
const { isLoading, data, error } = usePromise(
() =>
isInputValid(query)
- ? authManager.fetch(`/api/ns/name/${query}`).then((res) => {
+ ? fetch(new URL(`/ns/username/${query}`, apiUrl)).then((res) => {
if (res.status === 200) return res.json();
else throw res.status;
})