refactor: add formattedData in IConnection references

This commit is contained in:
Ali BARIN
2022-03-04 20:02:40 +01:00
committed by Ömer Faruk Aydın
parent 719a948134
commit 6a8ec97c31
9 changed files with 22 additions and 21 deletions

View File

@@ -21,12 +21,12 @@ type ChooseAccountSubstepProps = {
step: IStep;
};
const optionGenerator = (connection: IConnection<IJSONObject>): { label: string; value: string; } => ({
label: connection?.data?.screenName as string ?? 'Unnamed',
const optionGenerator = (connection: IConnection): { label: string; value: string; } => ({
label: connection?.formattedData?.screenName as string ?? 'Unnamed',
value: connection?.id as string,
});
const getOption = (options: Record<string, unknown>[], connectionId: string) => options.find(connection => connection.value === connectionId) || null;
const getOption = (options: Record<string, unknown>[], connectionId?: string) => options.find(connection => connection.value === connectionId) || null;
function ChooseAccountSubstep(props: ChooseAccountSubstepProps): React.ReactElement {
const {