mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Registered first actions as services
This commit is contained in:
parent
d6e53918a2
commit
12ddeebedf
2 changed files with 9 additions and 8 deletions
|
@ -136,10 +136,15 @@ bottle.decorator('DeleteShortUrlModal', connectDecorator(
|
||||||
[ 'shortUrlDeletion' ],
|
[ 'shortUrlDeletion' ],
|
||||||
{ deleteShortUrl, resetDeleteShortUrl, shortUrlDeleted }
|
{ deleteShortUrl, resetDeleteShortUrl, shortUrlDeleted }
|
||||||
));
|
));
|
||||||
|
|
||||||
|
bottle.serviceFactory('editShortUrlTags', editShortUrlTags, 'ShlinkApiClient');
|
||||||
|
bottle.serviceFactory('resetShortUrlsTags', () => resetShortUrlsTags);
|
||||||
|
bottle.serviceFactory('shortUrlTagsEdited', () => shortUrlTagsEdited);
|
||||||
|
|
||||||
bottle.serviceFactory('EditTagsModal', EditTagsModal, 'TagsSelector');
|
bottle.serviceFactory('EditTagsModal', EditTagsModal, 'TagsSelector');
|
||||||
bottle.decorator('EditTagsModal', connectDecorator(
|
bottle.decorator('EditTagsModal', connectDecorator(
|
||||||
[ 'shortUrlTags' ],
|
[ 'shortUrlTags' ],
|
||||||
{ editShortUrlTags, resetShortUrlsTags, shortUrlTagsEdited }
|
[ 'editShortUrlTags', 'resetShortUrlsTags', 'shortUrlTagsEdited' ]
|
||||||
));
|
));
|
||||||
|
|
||||||
export default container;
|
export default container;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { curry } from 'ramda';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import shlinkApiClient from '../../api/ShlinkApiClient';
|
import { pick } from 'ramda';
|
||||||
|
|
||||||
/* eslint-disable padding-line-between-statements, newline-after-var */
|
/* eslint-disable padding-line-between-statements, newline-after-var */
|
||||||
export const EDIT_SHORT_URL_TAGS_START = 'shlink/shortUrlTags/EDIT_SHORT_URL_TAGS_START';
|
export const EDIT_SHORT_URL_TAGS_START = 'shlink/shortUrlTags/EDIT_SHORT_URL_TAGS_START';
|
||||||
|
@ -40,8 +39,7 @@ export default function reducer(state = defaultState, action) {
|
||||||
};
|
};
|
||||||
case EDIT_SHORT_URL_TAGS:
|
case EDIT_SHORT_URL_TAGS:
|
||||||
return {
|
return {
|
||||||
shortCode: action.shortCode,
|
...pick([ 'shortCode', 'tags' ], action),
|
||||||
tags: action.tags,
|
|
||||||
saving: false,
|
saving: false,
|
||||||
error: false,
|
error: false,
|
||||||
};
|
};
|
||||||
|
@ -52,7 +50,7 @@ export default function reducer(state = defaultState, action) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const _editShortUrlTags = (shlinkApiClient, shortCode, tags) => async (dispatch) => {
|
export const editShortUrlTags = (shlinkApiClient) => (shortCode, tags) => async (dispatch) => {
|
||||||
dispatch({ type: EDIT_SHORT_URL_TAGS_START });
|
dispatch({ type: EDIT_SHORT_URL_TAGS_START });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -66,8 +64,6 @@ export const _editShortUrlTags = (shlinkApiClient, shortCode, tags) => async (di
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const editShortUrlTags = curry(_editShortUrlTags)(shlinkApiClient);
|
|
||||||
|
|
||||||
export const resetShortUrlsTags = () => ({ type: RESET_EDIT_SHORT_URL_TAGS });
|
export const resetShortUrlsTags = () => ({ type: RESET_EDIT_SHORT_URL_TAGS });
|
||||||
|
|
||||||
export const shortUrlTagsEdited = (shortCode, tags) => ({
|
export const shortUrlTagsEdited = (shortCode, tags) => ({
|
||||||
|
|
Loading…
Reference in a new issue