mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] Chat history prototype (#10278)
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
36231619db
commit
09bb0e61b3
@@ -4,16 +4,21 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { connectionLost } from './actions';
|
||||
import { connectionLost, updateExportData } from './actions';
|
||||
import { connectionRestored, dismissWarning } from './actions';
|
||||
import type { gameState } from './types';
|
||||
|
||||
const initialState = {
|
||||
const initialState: gameState = {
|
||||
// TODO: This is where round info should be.
|
||||
roundId: null,
|
||||
roundTime: null,
|
||||
roundRestartedAt: null,
|
||||
connectionLostAt: null,
|
||||
dismissedConnectionWarning: false,
|
||||
databaseBackendEnabled: false,
|
||||
chatlogApiEndpoint: '',
|
||||
databaseStoredRounds: [],
|
||||
userData: { ckey: '', token: '' },
|
||||
};
|
||||
|
||||
export const gameReducer = (state = initialState, action) => {
|
||||
@@ -29,6 +34,9 @@ export const gameReducer = (state = initialState, action) => {
|
||||
return {
|
||||
...state,
|
||||
roundId: payload.round_id,
|
||||
databaseBackendEnabled: payload.chatlog_db_backend,
|
||||
chatlogApiEndpoint: payload.chatlog_api_endpoint,
|
||||
databaseStoredRounds: payload.chatlog_stored_rounds,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -51,5 +59,11 @@ export const gameReducer = (state = initialState, action) => {
|
||||
dismissedConnectionWarning: true,
|
||||
};
|
||||
}
|
||||
if (type === updateExportData.type) {
|
||||
return {
|
||||
...state,
|
||||
userData: payload,
|
||||
};
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user