Skip to content

Commit f26c47d

Browse files
committed
8: add screenshots to readme and refactor interfaces
1 parent f953aac commit f26c47d

File tree

7 files changed

+62
-33
lines changed

7 files changed

+62
-33
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,17 @@ Add an angular jwt package, for handling the jwt, the login etc.
4949

5050
Add the Auth guard, to make sure only LoggedIn Users can access the Protected Module
5151
`ng g g Auth`
52-
then implement the CanActivate interface
52+
then implement the CanActivate interface
53+
54+
### Sample Screenshots
55+
Login View:
56+
![Login View](/screenshots/login-basic.jpg?raw=true "Login View")
57+
58+
Login View with errors displayed:
59+
![Login View with errors](/screenshots/login-errors.jpg?raw=true "Login View with an errors displayed")
60+
61+
Jwt Protected Dashboard after successfull login (only for Guard and Example purposes):
62+
![Dashboard for example purposes](/screenshots/jwt-protected-basic-dashboard.jpg?raw=true "Dashboard for example purposes")
63+
64+
Register Form with passwords not matching error displayed:
65+
![Register Form with Passwords not matching error displayed](/screenshots/register-forms-with-passwords-not-matching-hint.jpg?raw=true "Register Form with Passwords not matching error displayed")
71.4 KB
Loading

screenshots/login-basic.jpg

55.3 KB
Loading

screenshots/login-errors.jpg

57 KB
Loading
108 KB
Loading

src/app/public/interfaces.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
/*
3+
Interface for the Refresh Token (can look different, based on your backend api)
4+
*/
5+
export interface RefreshToken {
6+
id: number;
7+
userId: number;
8+
token: string;
9+
refreshCount: number;
10+
expiryDate: Date;
11+
}
12+
13+
/*
14+
Interface for the Login Response (can look different, based on your backend api)
15+
*/
16+
export interface LoginResponse {
17+
accessToken: string;
18+
refreshToken: RefreshToken;
19+
tokenType: string;
20+
}
21+
22+
/*
23+
Interface for the Login Request (can look different, based on your backend api)
24+
*/
25+
export interface LoginRequest {
26+
email: string;
27+
password: string;
28+
}
29+
30+
/*
31+
Interface for the Register Request (can look different, based on your backend api)
32+
*/
33+
export interface RegisterRequest {
34+
email: string;
35+
username: string;
36+
firstname: string;
37+
lastname: string;
38+
password: string;
39+
}
40+
41+
/*
42+
Interface for the Register Response (can look different, based on your backend api)
43+
*/
44+
export interface RegisterResponse {
45+
status: number;
46+
message: string;
47+
}

src/app/public/services/auth-service/auth.service.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,7 @@ import { Injectable } from '@angular/core';
44
import { map, Observable, of, switchMap, tap } from 'rxjs';
55
import { JwtHelperService } from '@auth0/angular-jwt';
66
import { MatSnackBar } from '@angular/material/snack-bar';
7-
8-
export interface RefreshToken {
9-
id: number;
10-
userId: number;
11-
token: string;
12-
refreshCount: number;
13-
expiryDate: Date;
14-
}
15-
16-
export interface LoginResponse {
17-
accessToken: string;
18-
refreshToken: RefreshToken;
19-
tokenType: string;
20-
}
21-
22-
export interface LoginRequest {
23-
email: string;
24-
password: string;
25-
}
26-
27-
export interface RegisterRequest {
28-
email: string;
29-
username: string;
30-
firstname: string;
31-
lastname: string;
32-
password: string;
33-
}
34-
35-
export interface RegisterResponse {
36-
status: number;
37-
message: string;
38-
}
7+
import { LoginRequest, LoginResponse, RegisterRequest, RegisterResponse } from '../../interfaces';
398

409
export const fakeLoginResponse: LoginResponse = {
4110
// fakeAccessToken.....should all come from real backend

0 commit comments

Comments
 (0)