diff --git a/src/actions/statistics.js b/src/actions/statistics.js index 719fad4e38bb0f6b0a1dd2e1534ff4f990385e09..9fb205e08aab8b13d89a0719d3f293c714f42ebf 100644 --- a/src/actions/statistics.js +++ b/src/actions/statistics.js @@ -8,7 +8,8 @@ import { ADD_EVENT, DELETE_EVENT, GET_PROFILES, - GET_SELECTED_PROFILE + GET_SELECTED_PROFILE, + SET_STATUS, } from './types'; export const getEvents = () => ( @@ -143,6 +144,10 @@ export const setStatus = (id, status) => ( role: status, }); if (response.data.id) { + dispatch({ + type: SET_STATUS, + payload: response.data, + }); } } catch (e) { console.log(e); diff --git a/src/actions/types.js b/src/actions/types.js index 5da10133278668b93d07b75489dfbca154d66503..70b3b996856e90c25d81f5711eb40309ddda009a 100644 --- a/src/actions/types.js +++ b/src/actions/types.js @@ -27,5 +27,5 @@ export const CLEAR_NOTE = 'clear_note'; export const ADD_EVENT_NOTE = 'add_note'; export const GET_PROFILES = 'get_profiles'; -export const SET_STAFF = 'set_staff'; +export const SET_STATUS = 'set_status'; export const GET_SELECTED_PROFILE = 'get_selected_profile'; diff --git a/src/components/pages/Applications.js b/src/components/pages/Applications.js index ce66eb2a10b1d807773831b470d554c077804e69..93761d8df45bad2f149f7aaf359eb085515e4107 100644 --- a/src/components/pages/Applications.js +++ b/src/components/pages/Applications.js @@ -72,7 +72,7 @@ class Applications extends Component { <Table.Header> <Table.Row> <Table.HeaderCell>Jelentkezettek</Table.HeaderCell> - <Table.HeaderCell>JelentkezĂŠs elfogadva:</Table.HeaderCell> + <Table.HeaderCell textAlign='center'>JelentkezĂŠs stĂĄtusza:</Table.HeaderCell> <Table.HeaderCell /> </Table.Row> </Table.Header> diff --git a/src/reducers/TraineeReducer.js b/src/reducers/TraineeReducer.js index e7696a20fca64669130859e709a25e2feee5249b..06f01ec8c9ffae5411512829a5607041807fadd1 100644 --- a/src/reducers/TraineeReducer.js +++ b/src/reducers/TraineeReducer.js @@ -1,4 +1,4 @@ -import { GET_TRAINEES, GET_PROFILES, GET_SELECTED_PROFILE } from '../actions/types'; +import { GET_TRAINEES, GET_PROFILES, GET_SELECTED_PROFILE, SET_STATUS } from '../actions/types'; const INITIAL_STATE = { profiles: [], selectedProfile: {} }; @@ -10,6 +10,13 @@ export default (state = INITIAL_STATE, action) => { return { ...state, profiles: [...action.payload] }; case GET_SELECTED_PROFILE: return { ...state, selectedProfile: action.payload }; + case SET_STATUS: + const index = state.profiles.findIndex(item => item.id === action.payload.id); + state.profiles.splice(index, 1, action.payload); + if (action.payload.id === state.selectedProfile.id) { + return { ...state, selectedProfile: action.payload }; + } + return { ...state, profiles: [...state.profiles] } default: return state; }