Refactoring the Frontend
In this lesson, we're going to refactor our frontend
Refactoring the frontend#
We have been working on our API for quite a long time. We need to get our frontend back to match up the speed as well. If you run the frontend and backend server and open localhost 3000, you will see errors, because now the response we're receiving has taken a different shape. We are receiving paginated result and also, we have added few more properties to our course entity. Let's create a new model called paginatedCourse. If you remember, we have four properties there. Let's write them down here. Export interface PaginatedCourse and inside, we have pageIndex of type number, count of type number, pageSize of type number and data which will be array of course, so we can import Course here. Also, we have added more properties to our Course model, so add them as well.
client/src/models/paginatedCourse.ts
import { Course } from './course';
export interface PaginatedCourse {
pageIndex: number;
count: number;
pageSize: number;
data: Course[];
}
We have added description of type string, category of type string, language of type string, level of type string, students of type number and subTitle of type string. Learnings will be an array of string or an empty string and same will be the requirements.
client/src/models/course.ts
This page is a preview of The newline Guide to Fullstack ASP.NET Core and React