我有这样的效果:
@Effect()
updateMappingAfterChangeFieldType$ = this.actions$.pipe(
ofType(EditableObjectSchemaActionTypes.EditFieldType),
withLatestFrom(
this.store.select(fromReducers.getMappingFields),
this.store.select(fromCore.getTimezones) // **
),
map(([action, mappingFields, timezones]: [EditFieldType, MappingModel[], Timezone[]]) =>
{
const { uuid } = action.payload;
const { fieldType } = action.payload;
const fieldForUpdate = mappingFields.find(field => field.uuid === uuid);
const defaultTimezone = timezones.find((timezone) => timezone.isDefault);// **
const timezoneId = fieldType === DATE_TYPE ? defaultTimezone.id : '';// **
return new UpdateExistingMapping({
...fieldForUpdate,
timezoneId
});
})
);
在许多地方使用标有//**
的行。我想让它成为可管理的操作员。所以它看起来像这样:
@Effect()
updateMappingAfterChangeFieldType$ = this.actions$.pipe(
ofType(EditableObjectSchemaActionTypes.EditFieldType),
withLatestFrom(
this.store.select(fromReducers.getMappingFields)
),
getDefaultTimezoneId,
map(([action, mappingFields, defaultTimezoneId]: [EditFieldType, MappingModel[], string]) =>
{
const { uuid } = action.payload;
const { fieldType } = action.payload;
const fieldForUpdate = mappingFields.find(field => field.uuid === uuid);
return new UpdateExistingMapping({
...fieldForUpdate,
timezoneId: defaultTimezoneId
});
})
);
我怎么能这样做?顺便说一句,效果是在课堂上。我如何导入pipe
?因为当我尝试import {pipe} from 'rxjs/Rx'
时,我收到有关黑名单的错误