Handle different types of error responses

This commit is contained in:
nikolark committed 2018-01-14 18:03:23 +01:00
1 parent 256460f8e4
commit 1829cef203
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -155,6 +155,11 @@ export default class UserRegister extends Component {
const err = errors.non_field_errors;
let errorFormatted = err ? err[0] : 'Kunne ikke registrere bruker, prøv igjen...';
return <View style={styles.errorBox}><Text style={styles.errorMessage}>{errorFormatted}</Text></View>
} else if (Object.keys(errors).length !== 0 && 'detail' in errors) {
const err = errors.detail;
let errorFormatted = err ? err : 'Kunne ikke registrere bruker, prøv igjen...';
return <View style={styles.errorBox}><Text style={styles.errorMessage}>{errorFormatted}</Text></View>
}
return <View style={styles.errorBox}/>