diff options
author | Ashm Walia <40498934+ashmgarv@users.noreply.github.com> | 2021-01-16 09:51:36 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-16 09:51:36 -0800 |
commit | 9711093bfa5810868e3cd17008bb7b3ddc7b9034 (patch) | |
tree | 6a8bb4341b1623cfc2da86af4b3b28c1fd3f8a44 /src/services/BlockUserService.ts | |
parent | d85eaeb878cbbeedda860ee5809b81100c910af2 (diff) | |
parent | 30391867438bb28cbcba9fc9ee2ff6d00027fd86 (diff) |
Merge branch 'master' into tma538-friend-requests
Diffstat (limited to 'src/services/BlockUserService.ts')
-rw-r--r-- | src/services/BlockUserService.ts | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/services/BlockUserService.ts b/src/services/BlockUserService.ts index 21e259b6..12ea0184 100644 --- a/src/services/BlockUserService.ts +++ b/src/services/BlockUserService.ts @@ -2,6 +2,7 @@ import {Alert} from 'react-native'; import {BLOCK_USER_ENDPOINT} from '../constants'; +import {ERROR_SOMETHING_WENT_WRONG_REFRESH} from '../constants/strings'; export const loadBlockedUsers = async (userId: string, token: string) => { try { @@ -44,18 +45,12 @@ export const blockOrUnblockUser = async ( return true; } else { console.log(await response.json()); - Alert.alert( - 'Something went wrong! ðŸ˜', - "Would you believe me if I told you that I don't know what happened?", - ); + Alert.alert(ERROR_SOMETHING_WENT_WRONG_REFRESH); return false; } } catch (error) { console.log(error); - Alert.alert( - 'Something went wrong! ðŸ˜', - "Would you believe me if I told you that I don't know what happened?", - ); + Alert.alert(ERROR_SOMETHING_WENT_WRONG_REFRESH); return false; } }; @@ -77,18 +72,12 @@ export const isUserBlocked = async ( if (Math.floor(response.status / 100) === 2) { const data = await response.json(); - return data['is_blocked']; + return data.is_blocked; } else { console.log(await response.json()); - Alert.alert( - 'Something went wrong! ðŸ˜', - "Would you believe me if I told you that I don't know what happened?", - ); + Alert.alert(ERROR_SOMETHING_WENT_WRONG_REFRESH); } } catch (error) { - Alert.alert( - 'Something went wrong! ðŸ˜', - "Would you believe me if I told you that I don't know what happened?", - ); + Alert.alert(ERROR_SOMETHING_WENT_WRONG_REFRESH); } }; |