Ensured domain is passed when deleting a short URL on a specific domain

This commit is contained in:
Alejandro Celaya
2020-02-08 09:57:18 +01:00
parent 861a3c068f
commit 098c94bccf
3 changed files with 11 additions and 8 deletions

View File

@@ -22,9 +22,9 @@ export default class DeleteShortUrlModal extends React.Component {
e.preventDefault();
const { deleteShortUrl, shortUrl, toggle } = this.props;
const { shortCode } = shortUrl;
const { shortCode, domain } = shortUrl;
deleteShortUrl(shortCode)
deleteShortUrl(shortCode, domain)
.then(toggle)
.catch(identity);
};

View File

@@ -30,13 +30,13 @@ export default handleActions({
[RESET_DELETE_SHORT_URL]: () => initialState,
}, initialState);
export const deleteShortUrl = (buildShlinkApiClient) => (shortCode) => async (dispatch, getState) => {
export const deleteShortUrl = (buildShlinkApiClient) => (shortCode, domain) => async (dispatch, getState) => {
dispatch({ type: DELETE_SHORT_URL_START });
const { deleteShortUrl } = await buildShlinkApiClient(getState);
try {
await deleteShortUrl(shortCode);
await deleteShortUrl(shortCode, domain);
dispatch({ type: SHORT_URL_DELETED, shortCode });
} catch (e) {
dispatch({ type: DELETE_SHORT_URL_ERROR, errorData: e.response.data });