Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async (dispatch: Dispatch>) => {
try {
dispatch(setWorkingOnIt(true));
const result = await api.setAttachments(item);
if (result) {
const msg = `Users ${(!item.enableAttachments ? "CAN" : "CAN NOT")}
attach files to items in this list ${item.title}.`;
const messageData = {
message: msg,
showMessage: true,
type: MessageBarType.success
} as IMessageData;
dispatch(getAllSiteContent(messageData));
} else {
throw new Error("Error setAttachments returned false");
}
} catch (error) {
// tslint:disable-next-line:no-console
console.log(error);
dispatch(setMessageData({
message: constants.ERROR_MESSAGE_SET_LIST_ATTACHMENTS_ENABLE,
showMessage: true,
type: MessageBarType.error
}));
}
};
};
render(): JSX.Element {
return Hello from {this.props.compiler} and {this.props.framework}!
}
}
};
case actions.UPDATE_PROPERTY:
const updtdPropperty: IProperty = action.payload;
const filtered = state.webProperties.map((prop: IProperty) => {
if (prop.key === updtdPropperty.key) {
return updtdPropperty;
} else {
return prop;
}
});
return {
...state, isWorkingOnIt: false,
messageData: {
message: constants.MESSAGE_PROPERTY_UPDATED,
showMessage: true,
type: MessageBarType.success
},
webProperties: filtered
};
case actions.SET_ALL_PROPERTIES:
const properties: IProperty[] = action.payload;
return { ...state, isWorkingOnIt: false, webProperties: properties };
case actions.SET_FILTER_TEXT:
const filterText: string = action.payload;
return { ...state, filterText };
case actions.SET_MESSAGE_DATA:
const messageData: IMessageData = action.payload;
return { ...state, messageData };
case actions.SET_USER_PERMISSIONS:
const userHasPermission: boolean = action.payload;
return { ...state, userHasPermission };
case actions.SET_WORKING_ON_IT:
.add('basic success', () => (
))
.add('basic warning', () => (
const IconButtonStyles = (props: IMessageBarStyleProps): IStyle => {
const { theme, messageBarType } = props;
const semanticColors = theme.semanticColors as IExtendedSemanticColors;
return [
(messageBarType === MessageBarType.error || messageBarType === MessageBarType.severeWarning) &&
generateBaseStyle(semanticColors.statusErrorBackground, semanticColors.statusErrorText),
messageBarType === MessageBarType.info &&
generateBaseStyle(semanticColors.statusInformationBackground, semanticColors.statusInformationText),
messageBarType === MessageBarType.success &&
generateBaseStyle(semanticColors.statusSuccessBackground, semanticColors.statusSuccessText),
(messageBarType === MessageBarType.warning || messageBarType === MessageBarType.blocked) &&
generateBaseStyle(semanticColors.statusWarningBackground, semanticColors.statusWarningText),
!messageBarType && generateBaseStyle(semanticColors.bodyBackground, semanticColors.bodyText)
];
};
export const spFeaturesReducer = (state: IInitialState = initialState, action: IAction): IInitialState => {
const getFeatureUpdatedMessage = (feature: IFeature): string => {
return "The web feature " + feature.name + " has been " + (!feature.activated ? "Activated" : "Deactivated");
};
switch (action.type) {
case actions.SET_SITE_FEATURES_AFTER_UPDATE:
const fSiteFeatures: IFeature[] = action.payload.features;
const fSiteFeature: IFeature = action.payload.feature;
return {
...state,
isWorkingOnIt: false,
messageData: {
message: getFeatureUpdatedMessage(fSiteFeature),
showMessage: true,
type: MessageBarType.success
},
siteFeatures: fSiteFeatures
};
case actions.SET_WEB_FEATURES_AFTER_UPDATE:
const fWebFeatures: IFeature[] = action.payload.features;
const fWebFeature: IFeature = action.payload.feature;
return {
...state,
isWorkingOnIt: false,
messageData: {
message: getFeatureUpdatedMessage(fWebFeature),
showMessage: true,
type: MessageBarType.success
},
webFeatures: fWebFeatures