From 5e8806934bbc31cc7b1c850b72a619dd1d0c3ad3 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Fri, 10 May 2019 16:09:38 +0300 Subject: [PATCH] Fix for #800 --- src/providers/esteem/ePoint.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/providers/esteem/ePoint.js b/src/providers/esteem/ePoint.js index 3f29b4d40..3b515a13f 100644 --- a/src/providers/esteem/ePoint.js +++ b/src/providers/esteem/ePoint.js @@ -1,6 +1,7 @@ +import { Alert } from 'react-native'; import ePointApi from '../../config/ePoint'; -export const userActivity = (us, ty, bl = '', tx = '') => new Promise((resolve, reject) => { +export const userActivity = (us, ty, bl = '', tx = '') => new Promise((resolve) => { const params = { us, ty }; if (bl) { @@ -17,11 +18,11 @@ export const userActivity = (us, ty, bl = '', tx = '') => new Promise((resolve, resolve(res.data); }) .catch((error) => { - reject(error); + Alert.alert('Error', error.message); }); }); -export const transfer = (sender, receiver, amount) => new Promise((resolve, reject) => { +export const transfer = (sender, receiver, amount) => new Promise((resolve) => { ePointApi .post('/transfer', { se: sender, @@ -32,33 +33,33 @@ export const transfer = (sender, receiver, amount) => new Promise((resolve, reje resolve(res.data); }) .catch((error) => { - reject(error); + Alert.alert('Error', error.message); }); }); -export const getUser = username => new Promise((resolve, reject) => { +export const getUser = username => new Promise((resolve) => { ePointApi .get(`/users/${username}`) .then((res) => { resolve(res.data); }) .catch((error) => { - reject(error); + Alert.alert('Error', error.message); }); }); -export const getUserPoints = username => new Promise((resolve, reject) => { +export const getUserPoints = username => new Promise((resolve) => { ePointApi .get(`/users/${username}/points`) .then((res) => { resolve(res.data); }) .catch((error) => { - reject(error); + Alert.alert('Error', error.message); }); }); -export const claim = username => new Promise((resolve, reject) => { +export const claim = username => new Promise((resolve) => { ePointApi .put('/claim', { us: `${username}`, @@ -67,6 +68,6 @@ export const claim = username => new Promise((resolve, reject) => { resolve(res.data); }) .catch((error) => { - reject(error); + Alert.alert('Error', error.message); }); });