Skip to content

Commit f997fbd

Browse files
committed
Fix redirect
1 parent bb5db90 commit f997fbd

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/app/src/components/form.jsx

+10-11
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@ class FormikForm extends Component {
3737
method: 'POST',
3838
body: data,
3939
credentials: 'include'
40-
}).then(
41-
data => {
42-
if (data) {
43-
window.location.replace(`/albums/${values.artist}-${values.title}`);
44-
} else {
45-
alert('You entered some invalid data');
46-
}
47-
});
40+
}).then(data => {
41+
if (data) {
42+
window.location.href = data.url;
43+
} else {
44+
alert('You entered some invalid data');
45+
}
46+
});
4847
}
4948
}
5049
render={({ errors, touched, isSubmitting, setFieldValue }) => (
@@ -60,12 +59,12 @@ class FormikForm extends Component {
6059

6160
<FormGroup>
6261
<ControlLabel htmlFor={this.nextUniqueId()}>Album logo</ControlLabel>
63-
<Field name="logo" id={this.lastUniqueId()} type="file"
62+
<Field name="album_logo" id={this.lastUniqueId()} type="file"
6463
className="form-control-file" onChange={(event) => {
6564
setFieldValue('file', event.currentTarget.files[0]);
6665
}} />
67-
{touched.logo && errors.logo &&
68-
<HelpBlock style={{ color: 'red' }}>{errors.logo}</HelpBlock>}
66+
{touched.album_logo && errors.album_logo &&
67+
<HelpBlock style={{ color: 'red' }}>{errors.album_logo}</HelpBlock>}
6968
</FormGroup>
7069

7170
<Field component={TagField} name="tags" onChange={setFieldValue} />

0 commit comments

Comments
 (0)