Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleLogin = () => {
const name = this.state.username;
const password = this.state.password;
// this.gotoHomePage()
// this.props.store.dispatch(login(true));
const url =
env.API_HOST +
`:` +
env.API_PORT +
`/api/v1/login?grant_type=password&client_id=client@letsgo&client_secret=Va4a8bFFhTJZdybnzyhjHjj6P9UVh7UL&scope=read&username=${name}&password=${password}`;
// ! FOR DEVELOPMENT ONLY
// const url =
// env.API_HOST +
// `:` +
// env.API_PORT +
// `/api/v1/login?grant_type=password&client_id=client@letsgo&client_secret=Va4a8bFFhTJZdybnzyhjHjj6P9UVh7UL&scope=read&username=a@a.com&password=1234`;
axios
.get(url)
.then(res => {
if (res.hasOwnProperty('data') && res.data.hasOwnProperty('access_token')) {
const token = res.data.access_token;
axios
_signIn = async () => {
try {
await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });
const userInfo = await GoogleSignin.signIn();
const idToken = userInfo.idToken;
axios
.post(`${env.API_HOST}:${env.API_PORT}/api/v1/auth/google`, { idToken })
.then(res => {
axios
.get(
`${env.API_HOST}:${env.API_PORT}/api/v1/login?grant_type=client_credentials&client_id=google@letsgo&client_secret=Va4a8bFFhTJZdybnzyhjHjj6P9UVh7UL`
)
.then(res => {})
.catch(err => {
console.log(err);
});
})
.catch(err => {});
} catch (error) {}
};
render() {
data => {
axios
.post(env.API_HOST + `:` + env.API_PORT + '/api/v1/user/coords', { lat: data.coords.latitude, long: data.coords.longitude })
.then(res => {
ToastAndroid.show('Location Sent Successfully', ToastAndroid.LONG);
})
.catch((e) => {
ToastAndroid.show('Location Sent Failed', ToastAndroid.LONG);
});
},
() => {