Skip to content

Commit

Permalink
linting 2
Browse files Browse the repository at this point in the history
  • Loading branch information
talyaron committed Aug 28, 2024
1 parent e26a0f0 commit de001b5
Show file tree
Hide file tree
Showing 13 changed files with 498 additions and 522 deletions.
35 changes: 0 additions & 35 deletions src/controllers/db/configKey.ts

This file was deleted.

33 changes: 18 additions & 15 deletions src/controllers/db/rooms/getRooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
where,
} from 'firebase/firestore';
import { DB } from '../config';
import { deleteRoom, setRoom, setRooms, setRoomSettings } from '@/model/rooms/roomsSlice';
import { deleteRoom, setRoom, setRooms, setRoomSettings } from '@/model/rooms/roomsSlice';
import { Unsubscribe } from 'firebase/auth';
import { store } from '@/model/store';

Expand All @@ -32,17 +32,17 @@ export function listenToParticipants(
const room = change.doc.data() as ParticipantInRoom;

switch (change.type) {
case 'added':
dispatch(setRoom(room));
break;
case 'modified':
dispatch(setRoom(room));
break;
case 'removed':
dispatch(deleteRoom(room));
break;
default:
break;
case 'added':
dispatch(setRoom(room));
break;
case 'modified':
dispatch(setRoom(room));
break;
case 'removed':
dispatch(deleteRoom(room));
break;
default:
break;
}
});

Expand All @@ -55,23 +55,26 @@ export function listenToParticipants(
console.error(error);

// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {};
return () => { };
}
}

// TODO: this function is not used. Delete it?


export function listenToRoomsSettings(statementId:string):Unsubscribe{
export function listenToRoomsSettings(statementId: string): Unsubscribe {
try {
const roomSettingRef = doc(DB, Collections.roomsSettings, statementId);

return onSnapshot(roomSettingRef, (doc) => {
if (!doc.exists()) return;
const roomSettings = doc.data() as RoomSettings;
store.dispatch(setRoomSettings(roomSettings));
});
} catch (error) {
console.error(error);
return () => {};

// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => { };
}
}
2 changes: 2 additions & 0 deletions src/controllers/db/rooms/setRooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function deleteParticipantToDB(
export async function toggleRoomEditingInDB(statementId: string): Promise<void> {
try {
const roomSettingsRef = doc(DB, Collections.roomsSettings, statementId);

//use transaction
await runTransaction(DB, async (transaction) => {
try {
Expand Down Expand Up @@ -113,6 +114,7 @@ export async function setParticipantsPerRoom({ statementId, add, number }: { sta

if (number && number >= 1) {
updateDoc(roomSettingsRef, { participantsPerRoom: number });

return;
}

Expand Down
Loading

0 comments on commit de001b5

Please sign in to comment.