Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onSubmit: async () => {
// We use empty text in UI to delete userID (null for AppCenter API).
const userId = this.state.userId.length === 0 ? null : this.state.userId;
if (userId !== null) {
await AsyncStorage.setItem(USER_ID_KEY, userId);
} else {
await AsyncStorage.removeItem(USER_ID_KEY);
}
await AppCenter.setUserId(userId);
}
},
onSubmit: async () => {
// We use empty text in UI to delete userID (null for AppCenter API).
const userId = this.state.userId.length === 0 ? null : this.state.userId;
if (userId !== null) {
await AsyncStorage.setItem(USER_ID_KEY, userId);
} else {
await AsyncStorage.removeItem(USER_ID_KEY);
}
await AppCenter.setUserId(userId);
}
},
}
}
const appSecretKey = await AsyncStorage.getItem(APP_SECRET);
for (let index = 0; index < AppSecrets.length; index++) {
const appSecret = AppSecrets[index];
if (appSecret.key === appSecretKey) {
this.state.appSecret = appSecret;
break;
}
}
const userId = await AsyncStorage.getItem(USER_ID_KEY);
if (userId !== null) {
this.state.userId = userId;
await AppCenter.setUserId(userId);
}
this.props.navigation.setParams({
refreshAppCenterScreen: this.refreshUI.bind(this)
});
await AppCenter.setLogLevel(AppCenter.LogLevel.VERBOSE);
}
async componentDidMount() {
await this.refreshUI();
const startupModeKey = await AsyncStorage.getItem(STARTUP_MODE);
for (let index = 0; index < StartupModes.length; index++) {
const startupMode = StartupModes[index];
if (startupMode.key === startupModeKey) {
this.state.startupMode = startupMode;
break;
}
}
const userId = await AsyncStorage.getItem(USER_ID_KEY);
if (userId !== null) {
this.state.userId = userId;
await AppCenter.setUserId(userId);
}
this.props.navigation.setParams({
refreshAppCenterScreen: this.refreshUI.bind(this)
});
}