Exemple #1
0
    return async dispatch => {
        const content = await api.translation.updateTranslation(
            entity,
            translation,
            locale,
            pluralForm,
            original,
        );

        if (content.same) {
            // The translation that was provided is the same as an existing
            // translation for that entity.
            // Show an error.
            console.error('Same Translation Error');
        }
        else if (content.type === 'added' || content.type === 'updated') {
            dispatch(
                entitiesActions.updateEntityTranslation(
                    entity,
                    pluralForm,
                    content.translation
                )
            );
        }
    }
Exemple #2
0
    return async dispatch => {
        const results = await updateStatusOnServer(change, translation, resource);
        if (results.translation && change === 'approve' && nextEntity && nextEntity.pk !== entity) {
            // The change did work, we want to move on to the next Entity.
            dispatch(navActions.updateEntity(router, nextEntity.pk.toString()));
        }
        else {
            dispatch(get(entity, locale, pluralForm));
        }

        if (results.stats) {
            dispatch(statsActions.update(results.stats));
        }

        dispatch(listActions.updateEntityTranslation(entity, pluralForm, results.translation));
    }