Commit 22b402a5 authored by Wietse Kuipers's avatar Wietse Kuipers
Browse files

Merge branch 'fix/registrations-update-loading' into 'master'

Fix/registrations update loading

See merge request !135
parents e7b125aa c8466ed3
...@@ -124,14 +124,14 @@ class Registration extends Component { ...@@ -124,14 +124,14 @@ class Registration extends Component {
} }
return <View />; return <View />;
})} })}
<View style={styles.buttonView}> {this.props.status !== 'loading' && <View style={styles.buttonView}>
<Button <Button
title="Aanpassen" title="Aanpassen"
color={colors.magenta} color={colors.magenta}
onPress={() => this.props.update(this.props.registration, this.state)} onPress={() => this.props.update(this.props.registration, this.state)}
disabled={!this.isFormValid()} disabled={!this.isFormValid()}
/> />
</View> </View>}
</ScrollView> </ScrollView>
); );
} }
......
...@@ -3,7 +3,7 @@ import * as registrationActions from '../actions/registration'; ...@@ -3,7 +3,7 @@ import * as registrationActions from '../actions/registration';
const initialState = { const initialState = {
registration: 0, registration: 0,
fields: {}, fields: {},
status: 'success', status: 'loading',
}; };
...@@ -34,6 +34,11 @@ export default function navigate(state = initialState, action = {}) { ...@@ -34,6 +34,11 @@ export default function navigate(state = initialState, action = {}) {
status: 'failure', status: 'failure',
}; };
} }
case registrationActions.FIELDS: {
return {
...initialState,
};
}
default: default:
return state; return state;
} }
......
...@@ -103,7 +103,8 @@ const fields = function* fields(action) { ...@@ -103,7 +103,8 @@ const fields = function* fields(action) {
const { registration } = action.payload; const { registration } = action.payload;
const token = yield select(tokenSelector); const token = yield select(tokenSelector);
yield put(eventActions.fetching()); yield put(registrationActions.loading());
yield put(navigationActions.navigate('registration'));
const data = { const data = {
method: 'GET', method: 'GET',
...@@ -117,7 +118,6 @@ const fields = function* fields(action) { ...@@ -117,7 +118,6 @@ const fields = function* fields(action) {
try { try {
const response = yield call(apiRequest, `registrations/${registration}`, data); const response = yield call(apiRequest, `registrations/${registration}`, data);
yield put(registrationActions.showFields(registration, response.fields)); yield put(registrationActions.showFields(registration, response.fields));
yield put(navigationActions.navigate('registration'));
yield put(eventActions.done()); yield put(eventActions.done());
} catch (error) { } catch (error) {
yield put(eventActions.failure()); yield put(eventActions.failure());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment