Skip to content

Commit

Permalink
Merge pull request #207 from SquareTable/206-retrying-user-report-fails
Browse files Browse the repository at this point in the history
Fixed retrying user report failing
  • Loading branch information
Sebastian-Webster authored Sep 20, 2023
2 parents 7a7390d + adaf392 commit 8410a1e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions screens/ReportAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const ReportAccount = ({navigation, route: routeData}) => {

const submitReportOfAccount = (reportType) => {
if (storedCredentials) {
setLastReportType(reportType)
if (reportType !== lastReportType) {
setLastReportType(reportType)
}
setSendingReport(true)
setError(null)
axios.post(serverUrl + '/tempRoute/reportUser', {reportType: reportType || lastReportType, reporteePubId: reportedAccountPubId}).then(response => {
Expand All @@ -50,7 +52,7 @@ const ReportAccount = ({navigation, route: routeData}) => {

}).catch(error => {
console.log("An error occured while reporting user.")
console.log(error)
console.error(error)
setSendingReport(false)
setError(ParseErrorMessage(error))
})
Expand Down Expand Up @@ -90,7 +92,7 @@ const ReportAccount = ({navigation, route: routeData}) => {
: error ?
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={{color: colors.errorColor, fontSize: 20, fontWeight: 'bold', textAlign: 'center', marginBottom: 20}}>{error}</Text>
<TouchableOpacity onPress={submitReportOfAccount}>
<TouchableOpacity onPress={() => submitReportOfAccount(lastReportType)}>
<Ionicons name="reload" size={50} color={colors.errorColor} />
</TouchableOpacity>
</View>
Expand Down

0 comments on commit 8410a1e

Please sign in to comment.