diff --git a/packages/marketplace/src/actions/client.ts b/packages/marketplace/src/actions/client.ts index 48600025c6..5527b06708 100644 --- a/packages/marketplace/src/actions/client.ts +++ b/packages/marketplace/src/actions/client.ts @@ -18,8 +18,6 @@ export const clientAppSummaryRequestDataFailure = actionCreator(ActionTy export const clientAppSummaryClearData = actionCreator(ActionTypes.CLIENT_APP_SUMMARY_CLEAR_DATA) // Client App Detail -export const clientAppDetailRequestData = actionCreator( - ActionTypes.CLIENT_APP_DETAIL_REQUEST_DATA, -) -export const clientAppDetailReceiveData = actionCreator(ActionTypes.CLIENT_APP_DETAIL_RECEIVE_DATA) -export const clientAppDetailRequestFailure = actionCreator(ActionTypes.CLIENT_APP_DETAIL_REQUEST_FAILURE) +export const clientFetchAppDetail = actionCreator(ActionTypes.CLIENT_FETCH_APP_DETAIL) +export const clientFetchAppDetailSuccess = actionCreator(ActionTypes.CLIENT_FETCH_APP_DETAIL_SUCCESS) +export const clientFetchAppDetailFailed = actionCreator(ActionTypes.CLIENT_FETCH_APP_DETAIL_FAILED) diff --git a/packages/marketplace/src/components/ui/client-app-detail/client-app-install-confirmation.tsx b/packages/marketplace/src/components/ui/client-app-detail/client-app-install-confirmation.tsx index ef68c3b386..a513bb0291 100644 --- a/packages/marketplace/src/components/ui/client-app-detail/client-app-install-confirmation.tsx +++ b/packages/marketplace/src/components/ui/client-app-detail/client-app-install-confirmation.tsx @@ -5,7 +5,7 @@ import { AppDetailModel } from '@reapit/foundations-ts-definitions' import appPermissionContentStyles from '@/styles/pages/app-permission-content.scss?mod' import { Button, Modal } from '@reapit/elements' import { appInstallationsRequestInstall } from '@/actions/app-installations' -import { clientAppDetailRequestData } from '@/actions/client' +import { clientFetchAppDetail } from '@/actions/client' import { Dispatch } from 'redux' import CallToAction from '../call-to-action' import { selectClientId } from '@/selector/client' @@ -30,7 +30,7 @@ export const handleInstallButtonClick = ( appId, callback: () => { dispatch( - clientAppDetailRequestData({ + clientFetchAppDetail({ id: appId, clientId, }), diff --git a/packages/marketplace/src/components/ui/client-app-detail/client-app-uninstall-confirmation.tsx b/packages/marketplace/src/components/ui/client-app-detail/client-app-uninstall-confirmation.tsx index 2f4e5874cb..ecb1638714 100644 --- a/packages/marketplace/src/components/ui/client-app-detail/client-app-uninstall-confirmation.tsx +++ b/packages/marketplace/src/components/ui/client-app-detail/client-app-uninstall-confirmation.tsx @@ -5,7 +5,7 @@ import { useDispatch, useSelector } from 'react-redux' import { AppDetailModel } from '@reapit/foundations-ts-definitions' import appPermissionContentStyles from '@/styles/pages/app-permission-content.scss?mod' import { Button, Modal } from '@reapit/elements' -import { clientAppDetailRequestData } from '@/actions/client' +import { clientFetchAppDetail } from '@/actions/client' import { appInstallationsRequestUninstall } from '@/actions/app-installations' import CallToAction from '../call-to-action' import { selectClientId } from '@/selector/client' @@ -33,7 +33,7 @@ export const onUninstallButtonClick = ( terminatedReason: 'User uninstall', callback: () => { dispatch( - clientAppDetailRequestData({ + clientFetchAppDetail({ id: appId, clientId, }), diff --git a/packages/marketplace/src/constants/action-types.ts b/packages/marketplace/src/constants/action-types.ts index 77caf8944d..43f433e1ab 100644 --- a/packages/marketplace/src/constants/action-types.ts +++ b/packages/marketplace/src/constants/action-types.ts @@ -63,9 +63,9 @@ const ActionTypes = { CLIENT_APP_SUMMARY_CLEAR_DATA: 'CLIENT_APP_SUMMARY_CLEAR_DATA', // Client App Detail - CLIENT_APP_DETAIL_REQUEST_DATA: 'CLIENT_APP_DETAIL_REQUEST_DATA', - CLIENT_APP_DETAIL_REQUEST_FAILURE: 'CLIENT_APP_DETAIL_REQUEST_FAILURE', - CLIENT_APP_DETAIL_RECEIVE_DATA: 'CLIENT_APP_DETAIL_RECEIVE_DATA', + CLIENT_FETCH_APP_DETAIL: 'CLIENT_FETCH_APP_DETAIL', + CLIENT_FETCH_APP_DETAIL_FAILED: 'CLIENT_FETCH_APP_DETAIL_FAILED', + CLIENT_FETCH_APP_DETAIL_SUCCESS: 'CLIENT_FETCH_APP_DETAIL_SUCCESS', // Installed apps actions INSTALLED_APPS_REQUEST_DATA: 'INSTALLED_APPS_REQUEST_DATA', diff --git a/packages/marketplace/src/reducers/client/app-detail.ts b/packages/marketplace/src/reducers/client/app-detail.ts index 28ea126b97..e5018a666b 100644 --- a/packages/marketplace/src/reducers/client/app-detail.ts +++ b/packages/marketplace/src/reducers/client/app-detail.ts @@ -1,6 +1,6 @@ import { AppDetailModel } from '@reapit/foundations-ts-definitions' import { Action } from '@/types/core' -import { clientAppDetailRequestData, clientAppDetailReceiveData, clientAppDetailRequestFailure } from '@/actions/client' +import { clientFetchAppDetail, clientFetchAppDetailSuccess, clientFetchAppDetailFailed } from '@/actions/client' import { isType } from '@/utils/actions' export type AppDetailData = (AppDetailModel & { apiKey?: string }) | null @@ -22,14 +22,14 @@ export const defaultState: ClientAppDetailState = { } const appDetailReducer = (state: ClientAppDetailState = defaultState, action: Action): ClientAppDetailState => { - if (isType(action, clientAppDetailRequestData)) { + if (isType(action, clientFetchAppDetail)) { return { ...state, isAppDetailLoading: true, } } - if (isType(action, clientAppDetailReceiveData)) { + if (isType(action, clientFetchAppDetailSuccess)) { return { ...state, isAppDetailLoading: false, @@ -37,7 +37,7 @@ const appDetailReducer = (state: ClientAppDetailState = defaultState, action: Ac } } - if (isType(action, clientAppDetailRequestFailure)) { + if (isType(action, clientFetchAppDetailFailed)) { return { ...state, isAppDetailLoading: false, diff --git a/packages/marketplace/src/sagas/apps/apps.ts b/packages/marketplace/src/sagas/apps/apps.ts index 4e791bb251..73b1aba125 100644 --- a/packages/marketplace/src/sagas/apps/apps.ts +++ b/packages/marketplace/src/sagas/apps/apps.ts @@ -1,4 +1,4 @@ -import { ClientAppDetailParams, clientAppDetailReceiveData, clientAppDetailRequestFailure } from '@/actions/client' +import { ClientAppDetailParams, clientFetchAppDetailSuccess, clientFetchAppDetailFailed } from '@/actions/client' import { put, call, fork, takeLatest, all } from '@redux-saga/core/effects' import ActionTypes from '@/constants/action-types' import { errorThrownServer } from '@/actions/error' @@ -15,10 +15,10 @@ export const fetchAppDetailSaga = function*({ data }: Action>(ActionTypes.CLIENT_APP_DETAIL_REQUEST_DATA, fetchAppDetailSaga) + yield takeLatest>(ActionTypes.CLIENT_FETCH_APP_DETAIL, fetchAppDetailSaga) } const appDetailSagas = function*() { diff --git a/packages/marketplace/src/utils/route-dispatcher.ts b/packages/marketplace/src/utils/route-dispatcher.ts index 6accb15bbb..4ef951d07a 100644 --- a/packages/marketplace/src/utils/route-dispatcher.ts +++ b/packages/marketplace/src/utils/route-dispatcher.ts @@ -4,7 +4,7 @@ import { RouteValue, StringMap } from '../types/core' import Routes from '../constants/routes' import { GET_ALL_PAGE_SIZE } from '../constants/paginator' import store from '../core/store' -import { clientAppSummaryRequestData, clientAppDetailRequestData } from '../actions/client' +import { clientAppSummaryRequestData, clientFetchAppDetail } from '../actions/client' import { myAppsRequestData } from '../actions/my-apps' import { installedAppsRequestData } from '../actions/installed-apps' import { developerRequestData, fetchMyIdentity } from '@/actions/developer' @@ -31,14 +31,14 @@ const routeDispatcher = async (route: RouteValue, params?: StringMap, search?: s case Routes.CLIENT_APP_DETAIL: { if (id) { const clientId = selectClientId(store.state) - store.dispatch(clientAppDetailRequestData({ id, clientId })) + store.dispatch(clientFetchAppDetail({ id, clientId })) } break } case Routes.CLIENT_APP_DETAIL_MANAGE: { if (id) { const clientId = selectClientId(store.state) - store.dispatch(clientAppDetailRequestData({ id, clientId })) + store.dispatch(clientFetchAppDetail({ id, clientId })) } break }