- Add type Definitions - Fix models methods - Sync controller add route names - Formularies sync OK - Closes https://lab.s-web.fr/ldc-web/projets/com-app-bo/-/issues/18 - Closes https://lab.s-web.fr/ldc-web/projets/com-app/-/issues/9
30 lines
587 B
JavaScript
30 lines
587 B
JavaScript
import { INIT_FORMS } from '../Actions/actionType';
|
|
// Models
|
|
import { Form } from '../../../Database';
|
|
|
|
const initialState = {
|
|
/** @type {Realm.Results<import('../../Models/Form').Form>} */
|
|
users: [],
|
|
};
|
|
|
|
/**
|
|
* @param {typeof initialState} state
|
|
* @param {import('../Actions/formularies').InitFormAction} action
|
|
* @returns
|
|
*/
|
|
const reducer = (state = initialState, action) => {
|
|
switch (action.type) {
|
|
case INIT_FORMS: {
|
|
return {
|
|
...state,
|
|
forms: Form.getAll(),
|
|
};
|
|
}
|
|
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
};
|
|
|
|
export default reducer;
|