Refactor login and register code

1. Abandoned try catch statement and use axios promise chains for handling the errors.
Avoided duplicated error handling logic for the same action
2. Removed unneeded useEffect in the input components
3. Refactor some code in the input components for better readability

Change-Id: I420ce4025a00cb842c743cb001983338d0359f46
diff --git a/server/src/routers/auth-router.ts b/server/src/routers/auth-router.ts
index 74fc1f5..736bfc2 100644
--- a/server/src/routers/auth-router.ts
+++ b/server/src/routers/auth-router.ts
@@ -104,7 +104,7 @@
       return;
     }
 
-    // Check if the account is stored stored on this daemon instance
+    // Check if the account is stored on this daemon instance
     const accountId = jamid.getAccountIdFromUsername(username);
     if (accountId === undefined) {
       res.status(HttpStatusCode.NotFound).send('Username not found');
@@ -126,6 +126,6 @@
     }
 
     const jwt = await signJwt(accountId);
-    res.send({ accessToken: jwt });
+    res.status(HttpStatusCode.Ok).send({ accessToken: jwt });
   })
 );
diff --git a/server/src/routers/nameserver-router.ts b/server/src/routers/nameserver-router.ts
index 415c2d1..e0f27e9 100644
--- a/server/src/routers/nameserver-router.ts
+++ b/server/src/routers/nameserver-router.ts
@@ -35,7 +35,7 @@
     const result = await jamid.lookupUsername(req.params.username, res.locals.accountId);
     switch (result.state) {
       case RegisteredNameFoundState.Found:
-        res.send(result);
+        res.status(HttpStatusCode.Ok).send(result);
         break;
       case RegisteredNameFoundState.InvalidResponse:
         res.status(HttpStatusCode.BadRequest).send('Invalid username');