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 {
}
return <View />;
})}
<View style={styles.buttonView}>
{this.props.status !== 'loading' && <View style={styles.buttonView}>
<Button
title="Aanpassen"
color={colors.magenta}
onPress={() => this.props.update(this.props.registration, this.state)}
disabled={!this.isFormValid()}
/>
</View>
</View>}
</ScrollView>
);
}
......
......@@ -3,7 +3,7 @@ import * as registrationActions from '../actions/registration';
const initialState = {
registration: 0,
fields: {},
status: 'success',
status: 'loading',
};
......@@ -34,6 +34,11 @@ export default function navigate(state = initialState, action = {}) {
status: 'failure',
};
}
case registrationActions.FIELDS: {
return {
...initialState,
};
}
default:
return state;
}
......
......@@ -103,7 +103,8 @@ const fields = function* fields(action) {
const { registration } = action.payload;
const token = yield select(tokenSelector);
yield put(eventActions.fetching());
yield put(registrationActions.loading());
yield put(navigationActions.navigate('registration'));
const data = {
method: 'GET',
......@@ -117,7 +118,6 @@ const fields = function* fields(action) {
try {
const response = yield call(apiRequest, `registrations/${registration}`, data);
yield put(registrationActions.showFields(registration, response.fields));
yield put(navigationActions.navigate('registration'));
yield put(eventActions.done());
} catch (error) {
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