Modifying the login page and defining the HTML template
In this section, we'll create a Umi mock file and requests to simulate user authentication, a login page for users to log in, and we'll configure the default HTML template for our application.
Let's start with the mock file. We'll create endpoints for login, logout, and getting user information. Follow these steps to create the file:
- Create a new file named
user.ts
in themock
folder. Next, create thelogin
function as follows:import { User } from '@/types/user.d'; import { Request, Response } from 'express'; const user: { currentUser: User } = { currentUser: { isLoggedIn: false, }, }; const login = (req: Request, res: Response) => { const { email, password } = req.body; };
- Add the following
if
statement to thelogin
function:if (email == 'john@doe.com' && password == 'user&apos...