Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sendTokenToServer = (token) => {
console.log(`Sending token ${token} to server`);
fetch(`${Config.SERVER_URL}/token/`, {
method: 'POST',
headers: {
'Content-Type': 'text/plain',
},
body: token,
})
.then(() => { console.log('Successfully sent token'); })
.catch((err) => { console.error('Failed to send token', err); });
};
signIn() {
this.state.ds = createDeepstream(Config.SERVER_URL);
this.state.ds.on('error', (error, event, topic ) => {
console.log(error, event, topic);
Actions.reset('signin', {ds: this.state.ds, configurePush: this.props.configurePush})
})
GoogleSignin.configure({
iosClientId: Config.IOS_CLIENT_ID,
webClientId: Config.WEB_CLIENT_ID
})
GoogleSignin.signIn()
.then((user) => {
this.state.ds.login({idToken: user.idToken, platform: Platform.OS}, (success, data) => {
if(success) {
this.state.username = data.username;
this.state.profileRecord = this.props.ds.record.getRecord('profile/'+ this.state.username);
this.state.dataRecord = this.props.ds.record.getRecord('data');
this.state.profileRecord.whenReady(() => {
componentWillMount() {
this.state.ds = createDeepstream(Config.SERVER_URL);
}
componentWillMount() {
this.state.ds = createDeepstream(Config.SERVER_URL);
}