Skip to content

YH-1816: added a mock request to getTaskList#1185

Open
alex273dbg-hub wants to merge 2 commits intodevelopfrom
feature/YH-1816
Open

YH-1816: added a mock request to getTaskList#1185
alex273dbg-hub wants to merge 2 commits intodevelopfrom
feature/YH-1816

Conversation

@alex273dbg-hub
Copy link
Copy Markdown
Collaborator

Сделал моковый запрос на получение задач

import { taskApiUrls } from '../../model/constants/task';
import { GetTasksListResponse, Task } from '../../model/types/task';

const mockTasks: Task[] = Array.from({ length: 2 }, (_, i) => ({
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - Оформи как в других моках. А именно вынеси в отдельный файл данные
Сделай массив без Array.from({ length: 2 }
Сделай с разными статусами, категориями, языками, уровнем подписки. И так чтобы было около 15, чтобы была доступна пагинация

subscriptionLevel: 'free',
}));

export const handlers = [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - Вместо handlers = [] укажи tasksListMock

}));

export const handlers = [
http.get(taskApiUrls.getTasksList, async ({ request }) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - Типизацию сделай такую же как у основного запроса

}));

export const handlers = [
http.get(taskApiUrls.getTasksList, async ({ request }) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - Url должен выгляеть так process.env.API_URL + taskApiUrls.getTasksList

const url = new URL(request.url);

const page = Number(url.searchParams.get('page') || '1');
const limit = Number(url.searchParams.get('limit') || '10');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - По остальным параметрам нужно делат фильтрацию

Image

const page = Number(url.searchParams.get('page') || '1');
const limit = Number(url.searchParams.get('limit') || '10');

const start = (page - 1) * limit;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - Посмотри как реализована пагинация в других запросах и сделай также

page: page,
};

await delay(500);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - delay не нужен

subscriptionLevel: 'free',
}));

export const handlers = [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[ISSUE] - Моковый запрос есть, но он не используется даже

@PerelomaDenis PerelomaDenis added feature New functionality or improvements comments Code improvements are required labels Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Code improvements are required feature New functionality or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants