"jdbc:mysql://[хост]:[порт]/[бд]?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"
import {ADD_USER} from './actionTypes';
import {HELLO} from './actionTypes';
import firebase from 'react-native-firebase';
export const addUser = (surname, name, patronymic, phone) => {
return async dispatch => {
let db = firebase.firestore();
let user = {
surname: surname,
name: name,
patronymic: patronymic,
phone: phone,
};
let result = 'начальный';
let docRef = db.collection('users').doc(user.phone);
try {
let doc = await docRef.get()
if (doc.exists) {
result = 'Такой номер уже есть';
console.log('Такой номер уже есть');
} else {
db.collection('users').doc(user.phone).set(user);
result = true;
console.log(true);
}
} catch (e) {
result = 'Произошла ошибка';
console.log('Произошла ошибка');
}
return result;
};
};
let result = this.props.onAddUser(
this.state.controls.surname.value,
this.state.controls.name.value,
this.state.controls.patronymic.value,
this.state.controls.phone.value,
).then(result => console.log(result))
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
// место для плагина
"plugins": ["transform-runtime", "transform-object-rest-spread"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["istanbul",]
}
}
}