Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
AshurovG committed Dec 15, 2024
1 parent beb954a commit 699e4d5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 32 deletions.
4 changes: 2 additions & 2 deletions public/components/UsersList/UsersList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export class UsersList {

constructor(parent: HTMLElement, users: UserNew[]) {
this.#parent = parent;
this.#users = this.getUniqueUsers(users);
this.#users = this.#getUniqueUsers(users);
}

getUniqueUsers(users: UserNew[]) {
#getUniqueUsers(users: UserNew[]) {
const seenUsernames = new Set<string>();
const uniqueUsers: UserNew[] = [];

Expand Down
13 changes: 7 additions & 6 deletions public/store/AuthPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { router } from 'modules/Router';
import { userStore } from 'store/UserStore';
import { throwBackendError, removeBackendError } from 'modules/BackendErrors';
import { roomPageStore } from './RoomPageStore';
import { User } from 'types/user';

class AuthPageStore {
constructor() {
Expand All @@ -21,11 +20,13 @@ class AuthPageStore {
);

const userAuthListener = userStore.isUserAuthEmmiter$.addListener(() => {
if (router.getCurrentPath() === '/auth') {
if (roomPageStore.getGlobalRoomId() && userStore.getUser().username) {
roomPageStore.setIsModalConfirm(false);
router.go('/room', roomPageStore.getGlobalRoomId());
}
if (
router.getCurrentPath() === '/auth' &&
roomPageStore.getGlobalRoomId() &&
userStore.getUser().username
) {
roomPageStore.setIsModalConfirm(false);
router.go('/room', roomPageStore.getGlobalRoomId());
}
});

Expand Down
16 changes: 0 additions & 16 deletions public/store/FavoritesPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ class FavoritesPageStore {
#movies: Movie[] | null = null;

constructor() {
// const unsubscribe = userStore.isUserAuthEmmiter$.addListener(
// async (status) => {
// if (status && router.getCurrentPath() === `/favorites`) {
// await this.getFavorites();
// favoritePage.render();
// }
// },
// );

const unsubscribe = userStore.isUserLoadingEmmiter$.addListener(() => {
if (router.getCurrentPath() === '/favorites') {
this.renderFavoritesPage();
Expand Down Expand Up @@ -106,13 +97,6 @@ class FavoritesPageStore {
async reduce(action: any) {
switch (action.type) {
case ActionTypes.RENDER_FAVORITES_PAGE:
// this.#movies = null;
// favoritePage.render();
// if (userStore.getUser().username) {
// await this.getFavorites();
// favoritePage.render();
// }

this.renderFavoritesPage(); // TK
break;
case ActionTypes.ADD_TO_FAVORITES:
Expand Down
6 changes: 1 addition & 5 deletions public/store/RoomPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,7 @@ class RoomPageStore {
}
break;
case 'change_movie':
if (
this.#room &&
messageData['movie'] &&
messageData['movie'].id !== this.#room.movie.id
) {
if (this.#room && messageData['movie'].id !== this.#room.movie.id) {
this.#room.movie = serializeMovieDetailed(messageData['movie']);
if (this.#room.movie.seasons && this.#room.movie.seasons.length) {
roomPage.renderVideo(
Expand Down
3 changes: 0 additions & 3 deletions public/store/UserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ class UserStore {
path: 'auth/session',
});

// TODO: Убрать после тестирование
// response.user_data.subscription_expiration_date = '2025-1-2';
// response.user_data.subscription_status = true;
response.user_data.email = response.user_data.email.replace(
/&#34;/g,
'"',
Expand Down

0 comments on commit 699e4d5

Please sign in to comment.