74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
/**
|
|
* Rooms store actions using `createActionGroup`.
|
|
*/
|
|
import {
|
|
createActionGroup,
|
|
emptyProps,
|
|
props
|
|
} from '@ngrx/store';
|
|
import {
|
|
Room,
|
|
RoomSettings,
|
|
ServerInfo,
|
|
RoomPermissions,
|
|
Channel
|
|
} from '../../core/models/index';
|
|
|
|
export const RoomsActions = createActionGroup({
|
|
source: 'Rooms',
|
|
events: {
|
|
'Load Rooms': emptyProps(),
|
|
'Load Rooms Success': props<{ rooms: Room[] }>(),
|
|
'Load Rooms Failure': props<{ error: string }>(),
|
|
|
|
'Search Servers': props<{ query: string }>(),
|
|
'Search Servers Success': props<{ servers: ServerInfo[] }>(),
|
|
'Search Servers Failure': props<{ error: string }>(),
|
|
|
|
'Create Room': props<{ name: string; description?: string; topic?: string; isPrivate?: boolean; password?: string }>(),
|
|
'Create Room Success': props<{ room: Room }>(),
|
|
'Create Room Failure': props<{ error: string }>(),
|
|
|
|
'Join Room': props<{ roomId: string; password?: string; serverInfo?: Partial<ServerInfo> & { name: string } }>(),
|
|
'Join Room Success': props<{ room: Room }>(),
|
|
'Join Room Failure': props<{ error: string }>(),
|
|
|
|
'Leave Room': emptyProps(),
|
|
'Leave Room Success': emptyProps(),
|
|
|
|
'View Server': props<{ room: Room }>(),
|
|
'View Server Success': props<{ room: Room }>(),
|
|
|
|
'Delete Room': props<{ roomId: string }>(),
|
|
'Delete Room Success': props<{ roomId: string }>(),
|
|
|
|
'Forget Room': props<{ roomId: string; nextOwnerKey?: string }>(),
|
|
'Forget Room Success': props<{ roomId: string }>(),
|
|
|
|
'Update Room Settings': props<{ roomId: string; settings: Partial<RoomSettings> }>(),
|
|
'Update Room Settings Success': props<{ roomId: string; settings: RoomSettings }>(),
|
|
'Update Room Settings Failure': props<{ error: string }>(),
|
|
|
|
'Update Room Permissions': props<{ roomId: string; permissions: Partial<RoomPermissions> }>(),
|
|
|
|
'Update Server Icon': props<{ roomId: string; icon: string }>(),
|
|
'Update Server Icon Success': props<{ roomId: string; icon: string; iconUpdatedAt: number }>(),
|
|
'Update Server Icon Failure': props<{ error: string }>(),
|
|
|
|
'Set Current Room': props<{ room: Room }>(),
|
|
'Clear Current Room': emptyProps(),
|
|
|
|
'Update Room': props<{ roomId: string; changes: Partial<Room> }>(),
|
|
'Receive Room Update': props<{ room: Partial<Room> }>(),
|
|
|
|
'Select Channel': props<{ channelId: string }>(),
|
|
'Add Channel': props<{ channel: Channel }>(),
|
|
'Remove Channel': props<{ channelId: string }>(),
|
|
'Rename Channel': props<{ channelId: string; name: string }>(),
|
|
|
|
'Clear Search Results': emptyProps(),
|
|
'Set Connecting': props<{ isConnecting: boolean }>(),
|
|
'Set Signal Server Reconnecting': props<{ isReconnecting: boolean }>()
|
|
}
|
|
});
|