Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should raise an error when lead to an incompatible type', () => {
// $ExpectError
(Constants.deviceId: boolean);
// $ExpectError
(Constants.linkingUrl: boolean);
});
});
const createEmergency = async (
description: string,
{ longitude, latitude }: EmergencyCoordinates
) => {
try {
const response = await fetch(`${env.apiUrl}emergencies/create`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
deviceId: Constants.deviceId,
description,
coordinates: [longitude, latitude]
})
});
await response.json();
} catch (error) {
console.log(error.message);
}
};
constructor(props) {
super(props)
this.state = {
isLoadingComplete: false,
}
Analytics.init(Constants.deviceId)
}
constructor(props: Props) {
super(props);
this.state = {
isLoadingComplete: false
};
Analytics.init(Constants.deviceId);
}
const getUserHistory = async () => {
try {
const response = await fetch(
`${env.apiUrl}emergencies/history?deviceId=${Constants.deviceId}`,
{
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
}
}
);
const { emergencies }: { emergencies: Emergency[] } = await response.json();
return emergencies;
} catch (error) {
return console.log(error.message);
}
};
constructor(propertyId, additionalParameters = {}, options = defaultOptions){
this.propertyId = propertyId;
this.options = options;
this.clientId = Constants.deviceId;
this.promiseGetWebViewUserAgentAsync = getWebViewUserAgent(options)
.then(userAgent => {
this.userAgent = userAgent;
this.parameters = {
an: Constants.manifest.name,
aid: Constants.manifest.slug,
av: Constants.manifest.version,
sr: `${width}x${height}`,
...additionalParameters
};
if(this.options.debug){
console.log(`[expo-analytics] UserAgent=${userAgent}`);
console.log(`[expo-analytics] Additional parameters=`, this.parameters);
public render() {
const navigate = this.props.navigation.navigate;
return (