Skip to content

Commit

Permalink
[frontend] feat: Login spinner and error text
Browse files Browse the repository at this point in the history
  • Loading branch information
helloitsdave committed Mar 24, 2024
1 parent 8c8702b commit 9857fb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ body {
height: 100vh;
margin: 0px;
background: linear-gradient(100deg, #83a4d4, #b6fbff);
background-attachment: fixed;
}

@media (min-width: 600px) {
Expand All @@ -29,7 +30,7 @@ body {
border: 2px solid white;
border-radius: 20px;
width: 260px;
height: 200px;
height: 280px;
padding: 20px;
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Login: React.FC<LoginProps> = ({ onLogin }) => {


const handleSubmit = async (e: React.FormEvent) => {
setErrorText("");
setIsDataLoading(true);
e.preventDefault();
try {
Expand All @@ -24,7 +25,6 @@ const Login: React.FC<LoginProps> = ({ onLogin }) => {
// Store the token in local storage as a temp solution
localStorage.setItem("token", data.token);
onLogin();
setErrorText("");
} catch (error) {
const errors = error as Error | AxiosError;
// Check if the error is an AxiosError
Expand Down Expand Up @@ -61,7 +61,7 @@ const Login: React.FC<LoginProps> = ({ onLogin }) => {
/>
<button type="submit">Login</button>
{ isDataLoading && <Spinner /> }
{errorText && <span>{errorText}</span>}
{errorText !== "" && <span>{errorText}</span>}
</form>
</div>
);
Expand Down

1 comment on commit 9857fb9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

91.58%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   App.tsx0%0%0%1, 1, 10–19, 2, 20–27, 3–9
   NoteApp.tsx94.12%100%96.69%66–70
src/api
   apiService.ts100%100%100%
src/components
   Header.tsx0%0%0%1, 1–9
   Login.tsx80%100%98.57%33, 33–34
   Note.tsx100%100%100%
   NoteForm.tsx100%100%100%
   NoteFormModal.tsx100%100%100%
   NoteGrid.tsx100%100%100%
   Spinner.tsx100%100%100%

Please sign in to comment.