From e8c77361c340d7e137266f97e9f8fada947ba6c1 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Sun, 13 Aug 2017 22:13:48 -0300 Subject: [PATCH] [FIX] Cant add new server --- app/views/serverNew.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/serverNew.js b/app/views/serverNew.js index 22a9179f1..6f0978d8d 100644 --- a/app/views/serverNew.js +++ b/app/views/serverNew.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import { Navigation } from 'react-native-navigation'; import { Text, TextInput, View, StyleSheet } from 'react-native'; import _ from 'underscore'; +import realm from '../lib/realm'; import KeyboardView from '../components/KeyboardView'; @@ -47,7 +48,6 @@ const styles = StyleSheet.create({ } }); - export default class NewServerView extends React.Component { static propTypes = { navigator: PropTypes.object.isRequired @@ -79,6 +79,9 @@ export default class NewServerView extends React.Component { this.inputElement.blur(); this.validateServer(url).then(() => { + realm.write(() => { + realm.create('servers', { id: url, current: false }, true); + }); Navigation.dismissModal({ animationType: 'slide-down' }); @@ -142,7 +145,7 @@ export default class NewServerView extends React.Component { validating: true }); - const a = fetch(url, { method: 'HEAD' }) + fetch(url, { method: 'HEAD' }) .then((response) => { if (!this._mounted) { return; @@ -171,7 +174,7 @@ export default class NewServerView extends React.Component { }); reject(url); }); - console.log(a.stop); + } else { this.setState({ validInstance: undefined