bug fixes
This commit is contained in:
parent
92842c0069
commit
d159a4a682
|
@ -379,12 +379,10 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
callLogs(response.data, "success", "frontend", subject, action)
|
||||
onSuccess(response.data)
|
||||
}).catch(async (err) => {
|
||||
const hasResponse = err?.response && err?.response?.data;
|
||||
|
||||
const errorToResponse = {
|
||||
status: hasResponse ? err.response.data.status || err.response.status : null,
|
||||
message: hasResponse ? err.response.data.message || err.response.message : "Something went wrong, please try again."
|
||||
};
|
||||
status: err?.response?.data?.status || err?.response?.status,
|
||||
message: err?.response?.data?.message || err?.response?.message || "Something went wrong, please try again."
|
||||
}
|
||||
|
||||
if(errorToResponse.status === 401) {
|
||||
let tokens = await DB.get("token");
|
||||
|
@ -409,13 +407,13 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
}
|
||||
}
|
||||
})
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(err?.response); // Always use errorToResponse
|
||||
callLogs(err?.response, "error", "frontend", subject, action)
|
||||
onError(err?.response)
|
||||
return;
|
||||
}
|
||||
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(errorToResponse);
|
||||
callLogs(err?.response, "error", "frontend", subject, action);
|
||||
onError(errorToResponse)
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
@ -431,13 +429,10 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
callLogs(response.data, "success", "frontend", subject, action)
|
||||
onSuccess(response.data)
|
||||
}).catch(async (err) => {
|
||||
const hasResponse = err?.response && err?.response?.data;
|
||||
|
||||
const errorToResponse = {
|
||||
status: hasResponse ? err.response.data.status || err.response.status : null,
|
||||
message: hasResponse ? err.response.data.message || err.response.message : "Something went wrong, please try again."
|
||||
};
|
||||
|
||||
status: err?.response?.data?.status || err?.response?.status,
|
||||
message: err?.response?.data?.message || err?.response?.message || "Something went wrong, please try again."
|
||||
}
|
||||
|
||||
if(errorToResponse.status === 401) {
|
||||
let tokens = await DB.get("token");
|
||||
|
@ -462,14 +457,13 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
}
|
||||
}
|
||||
})
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(err?.response); // Always use errorToResponse
|
||||
callLogs(err?.response, "error", "frontend", subject, action)
|
||||
onError(err?.response)
|
||||
return;
|
||||
}
|
||||
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(errorToResponse);
|
||||
|
||||
callLogs(err?.response, "error", "frontend", subject, action);
|
||||
onError(errorToResponse)
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
@ -488,13 +482,10 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
onSuccess(response.data)
|
||||
}).catch(async (err) => {
|
||||
console.log(err)
|
||||
const hasResponse = err?.response && err?.response?.data;
|
||||
|
||||
const errorToResponse = {
|
||||
status: hasResponse ? err.response.data.status || err.response.status : null,
|
||||
message: hasResponse ? err.response.data.message || err.response.message : "Something went wrong, please try again."
|
||||
};
|
||||
|
||||
status: err?.response?.data?.status || err?.response?.status,
|
||||
message: err?.response?.data?.message || err?.response?.message || "Something went wrong, please try again."
|
||||
}
|
||||
|
||||
if(errorToResponse.status === 401) {
|
||||
let tokens = await DB.get("token");
|
||||
|
@ -519,13 +510,13 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
}
|
||||
}
|
||||
})
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(err?.response); // Always use errorToResponse
|
||||
callLogs(err?.response, "error", "frontend", subject, action)
|
||||
onError(err?.response)
|
||||
return;
|
||||
}
|
||||
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(errorToResponse);
|
||||
callLogs(err?.response, "error", "frontend", subject, action);
|
||||
onError(errorToResponse)
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
@ -541,13 +532,10 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
callLogs(response.data, "success", "frontend", subject, action)
|
||||
onSuccess(response.data)
|
||||
}).catch(async (err) => {
|
||||
const hasResponse = err?.response && err?.response?.data;
|
||||
|
||||
const errorToResponse = {
|
||||
status: hasResponse ? err.response.data.status || err.response.status : null,
|
||||
message: hasResponse ? err.response.data.message || err.response.message : "Something went wrong, please try again."
|
||||
};
|
||||
|
||||
status: err?.response?.data?.status || err?.response?.status,
|
||||
message: err?.response?.data?.message || err?.response?.message || "Something went wrong, please try again."
|
||||
}
|
||||
|
||||
if(errorToResponse.status === 401) {
|
||||
let tokens = await DB.get("token");
|
||||
|
@ -572,13 +560,13 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
}
|
||||
}
|
||||
})
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(err?.response); // Always use errorToResponse
|
||||
callLogs(err?.response, "error", "frontend", subject, action)
|
||||
onError(err?.response)
|
||||
return;
|
||||
}
|
||||
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(errorToResponse);
|
||||
callLogs(err?.response, "error", "frontend", subject, action);
|
||||
onError(errorToResponse)
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
@ -597,13 +585,10 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
callLogs(response.data, "success", "frontend", subject, action)
|
||||
onSuccess(response.data)
|
||||
}).catch(async (err) => {
|
||||
const hasResponse = err?.response && err?.response?.data;
|
||||
|
||||
const errorToResponse = {
|
||||
status: hasResponse ? err.response.data.status || err.response.status : null,
|
||||
message: hasResponse ? err.response.data.message || err.response.message : "Something went wrong, please try again."
|
||||
};
|
||||
|
||||
status: err?.response?.data?.status || err?.response?.status,
|
||||
message: err?.response?.data?.message || err?.response?.message || "Something went wrong, please try again."
|
||||
}
|
||||
|
||||
if(errorToResponse.status === 401) {
|
||||
let tokens = await DB.get("token");
|
||||
|
@ -628,13 +613,13 @@ export default async function API(endpoint, method, headers, params, body, onSuc
|
|||
}
|
||||
}
|
||||
})
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(err?.response); // Always use errorToResponse
|
||||
callLogs(err?.response, "error", "frontend", subject, action)
|
||||
onError(err?.response)
|
||||
return;
|
||||
}
|
||||
|
||||
callLogs(err?.response || err, "error", "frontend", subject, action);
|
||||
onError(errorToResponse);
|
||||
callLogs(err?.response, "error", "frontend", subject, action);
|
||||
onError(errorToResponse)
|
||||
})
|
||||
return;
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ class ApplyCardD extends React.PureComponent {
|
|||
<Text style={{ fontSize: 16, color: this.props.app_theme?.theme.dark ? this.props.app_theme?.theme.colors.text : Theme.colors.textPrimary, width: '85%', textAlign: 'center'}}>Select your preferred card type</Text>
|
||||
</View>
|
||||
<FlatList
|
||||
scrollEnabled={false}
|
||||
data={this.state.Cards}
|
||||
contentContainerStyle={{ flex: 1, padding: 30 }}
|
||||
numColumns={2}
|
||||
|
|
|
@ -6,10 +6,12 @@ import { getAppVersion, getOS, getOSVersion, getUniqueID } from './device.js';
|
|||
import { getModel } from 'react-native-device-info';
|
||||
|
||||
export const callLogs = async (error, status, type, subject, action) => {
|
||||
|
||||
try {
|
||||
const name = Theme.formatter.NAME(store.getState().appUserInfoReducer.userinfo.data);
|
||||
const data = {
|
||||
"project": environment.PROJECT_CODE,
|
||||
"user": name || "Guest",
|
||||
"user": name,
|
||||
"source": type || "frontend",
|
||||
"type": status,
|
||||
"subject": subject || "Screen",
|
||||
|
@ -35,4 +37,7 @@ export const callLogs = async (error, status, type, subject, action) => {
|
|||
"Project-Key": environment.PROJECT_KEY
|
||||
}
|
||||
})
|
||||
}catch {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue