2025-05-10 02:09:06 +02:00
|
|
|
/*!
|
|
|
|
|
* Copyright (c) 2024 PLANKA Software GmbH
|
|
|
|
|
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
|
|
|
|
*/
|
|
|
|
|
|
2023-10-17 19:18:19 +02:00
|
|
|
import ActionTypes from '../constants/ActionTypes';
|
|
|
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
|
isInitializing: true,
|
|
|
|
|
config: null,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line default-param-last
|
|
|
|
|
export default (state = initialState, { type, payload }) => {
|
|
|
|
|
switch (type) {
|
2025-05-10 02:09:06 +02:00
|
|
|
case ActionTypes.SOCKET_RECONNECT_HANDLE:
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
config: payload.config,
|
|
|
|
|
};
|
2023-10-17 19:18:19 +02:00
|
|
|
case ActionTypes.LOGIN_INITIALIZE:
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
isInitializing: false,
|
|
|
|
|
config: payload.config,
|
|
|
|
|
};
|
|
|
|
|
case ActionTypes.AUTHENTICATE__SUCCESS:
|
2025-05-10 02:09:06 +02:00
|
|
|
case ActionTypes.WITH_OIDC_AUTHENTICATE__SUCCESS:
|
2023-10-17 19:18:19 +02:00
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
isInitializing: true,
|
|
|
|
|
};
|
|
|
|
|
case ActionTypes.CORE_INITIALIZE:
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
isInitializing: false,
|
2023-10-20 22:34:58 +02:00
|
|
|
};
|
|
|
|
|
case ActionTypes.CORE_INITIALIZE__CONFIG_FETCH:
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
config: payload.config,
|
2023-10-17 19:18:19 +02:00
|
|
|
};
|
2025-05-10 02:09:06 +02:00
|
|
|
case ActionTypes.USER_UPDATE_HANDLE:
|
|
|
|
|
if (payload.config) {
|
|
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
config: payload.config,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return state;
|
2023-10-17 19:18:19 +02:00
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
};
|