Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Закончил задачу джуна переписать на NGRX #105

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

nurik-nuxt
Copy link

telegram @nurtuganulyn

@nurik-nuxt nurik-nuxt changed the title Закончил джун переписать на NGRX Закончил задачу джуна переписать на NGRX Dec 28, 2024
src/app/services/local-storage.service.ts Outdated Show resolved Hide resolved
src/app/services/local-storage.service.ts Outdated Show resolved Hide resolved
src/app/services/local-storage.service.ts Outdated Show resolved Hide resolved
src/app/services/users.service.ts Outdated Show resolved Hide resolved
src/app/services/users.service.ts Outdated Show resolved Hide resolved
src/app/user-list/user-card/user-card.component.ts Outdated Show resolved Hide resolved
src/app/user-list/user-list.component.ts Outdated Show resolved Hide resolved
src/app/user-list/user-list.component.ts Outdated Show resolved Hide resolved
src/app/user-list/user-list.component.ts Outdated Show resolved Hide resolved
Copy link

@asylbekovkairat asylbekovkairat left a comment

Choose a reason for hiding this comment

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

некоторые комментарии не исправлены

src/app/services/local-storage.service.ts Outdated Show resolved Hide resolved
src/app/services/users-api.service.ts Show resolved Hide resolved
src/app/services/users-api.service.ts Outdated Show resolved Hide resolved
src/app/services/users-api.service.ts Outdated Show resolved Hide resolved
src/app/services/users.service.ts Outdated Show resolved Hide resolved
src/app/state/users/users.actions.ts Outdated Show resolved Hide resolved
src/app/state/users/users.reducer.ts Outdated Show resolved Hide resolved
src/app/user-list/user-list.component.ts Outdated Show resolved Hide resolved
src/app/user-list/user-list.component.ts Outdated Show resolved Hide resolved
src/app/user-list/user-list.component.ts Outdated Show resolved Hide resolved

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
imports: [RouterOutlet, UserListComponent],

Choose a reason for hiding this comment

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

Корректное название для компоненты UsersListComponent, так как это список пользователей (множ. число)

Copy link
Author

Choose a reason for hiding this comment

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

сделано


loadUser(): void {
this.usersApiService.getUsers()
.pipe(takeUntil(this.destroy$)) // Отписка при уничтожении

Choose a reason for hiding this comment

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

удалите комментарии везде

Copy link
Author

Choose a reason for hiding this comment

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

сделано

import { createSelector } from '@ngrx/store';
import { User } from "../../types/user.types";

interface UserState {

Choose a reason for hiding this comment

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

в файле users.selectors тип называется UserState?
Пользователи во множ.числе UsersState нужно

Copy link
Author

Choose a reason for hiding this comment

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

сделано

providedIn: 'root'
})
export class UsersService implements OnDestroy {
private userSubject = new BehaviorSubject<User[]>([]);

Choose a reason for hiding this comment

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

добавляйте readonly по надобности

inject рядом с inject
BehaviorSubject рядом с BehaviorSubject

Copy link
Author

Choose a reason for hiding this comment

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

сделал

editUser(editedUser: User) {
const users = this.userSubject.value.map(user =>
user.id === editedUser.id ? editedUser : user
);

Choose a reason for hiding this comment

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

пустуй строку добавьте перед this.userSubject.next(users);, чтобы визуально отделить логику

Copy link
Author

Choose a reason for hiding this comment

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

сделал

}

createUser(newUser: User) {
const users = [...this.userSubject.value, newUser];

Choose a reason for hiding this comment

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

пустуй строку добавьте перед this.userSubject.next(users);чтобы визуально отделить логику

Copy link
Author

Choose a reason for hiding this comment

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

сделал

import {Component} from "@angular/core";
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
import {NgIf} from "@angular/common";
import {MatDialogClose} from "@angular/material/dialog";

Choose a reason for hiding this comment

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

не сделано, установите prettier

import {Component} from "@angular/core";
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
import {NgIf} from "@angular/common";
import {MatDialogClose} from "@angular/material/dialog";

Choose a reason for hiding this comment

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

});

dialogRef.afterClosed().subscribe(editResult => {
if (!editResult) return;

Choose a reason for hiding this comment

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

если после return, есть код, то ставьте пустую строку

Copy link
Author

Choose a reason for hiding this comment

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

сделано

})

export class UsersListComponent {
public readonly store = inject(Store);

Choose a reason for hiding this comment

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

вы уверены что все 3 зависимости public? поставьте каждому private и если работает, оставьте private

Copy link
Author

Choose a reason for hiding this comment

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

сделал

providedIn: 'root',
})
export class UsersService implements OnDestroy {
private readonly userSubject = new BehaviorSubject<User[]>([])

Choose a reason for hiding this comment

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

в названии для subject нужно добавлять $ это общепринятая практика, что бы указать визуально что это поток

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants