From 61825185ab63b71202f79d2a5a4c9e75ba2c4348 Mon Sep 17 00:00:00 2001 From: nidhigarg-bmw <101316912+nidhigarg-bmw@users.noreply.github.com> Date: Fri, 24 May 2024 12:11:04 +0530 Subject: [PATCH] fix(app subscription): fix blank page on autosetup call (#820) --- CHANGELOG.md | 7 +++++ .../ActivateSubscriptionOverlay/index.tsx | 28 ++++++++++--------- .../appSubscriptionApiSlice.ts | 6 ++-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1f06d866..a2145b243 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.0.0-RC9 + +### Bugfix + +- App Subscription + - Blank Page fix on autosetup call + ## 2.0.0-RC8 ### Feature diff --git a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx index c4fc8bc8f..9a436565f 100644 --- a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx +++ b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx @@ -77,7 +77,7 @@ const ActivateSubscriptionOverlay = ({ const [URLErrorMsg, setURLErrorMessage] = useState('') const [loading, setLoading] = useState(false) const [activationResponse, setActivationResponse] = - useState() + useState() const [addUserSubscribtion] = useAddUserSubscribtionMutation() const { data } = useFetchTechnicalUserProfilesQuery(appId) @@ -102,6 +102,7 @@ const ActivateSubscriptionOverlay = ({ } catch (error) { console.log(error) } + setLoading(false) } const closeActivationOverlay = () => { @@ -117,30 +118,31 @@ const ActivateSubscriptionOverlay = ({ ], } - const activationData = activationResponse?.map( - (userdata: SubscriptionActivationResponse) => [ - [ - t('content.appSubscription.activation.appClientId'), - `${userdata?.clientInfo?.clientId}`, - ], + const activationData = activationResponse?.technicalUserInfo + ?.map((userdata) => [ [ t('content.appSubscription.activation.technicalClientId'), - `${userdata?.technicalUserInfo?.technicalClientId}`, + `${userdata?.technicalClientId}`, ], [ t('content.appSubscription.activation.technicalSecret'), - `${userdata?.technicalUserInfo?.technicalUserSecret}`, + `${userdata?.technicalUserSecret}`, ], [ t('content.appSubscription.activation.technicalPermission'), - `${userdata?.technicalUserInfo?.technicalUserPermissions.toString()}`, + `${userdata?.technicalUserPermissions?.toString()}`, ], - ] - ) + ]) + .flat(1) + + activationData?.unshift([ + t('content.appSubscription.activation.appClientId'), + `${activationResponse?.clientInfo?.clientId}`, + ]) const tableData2: TableType = { head: [t('content.appSubscription.activation.technicalDetails'), ''], - body: activationData?.flat(1) ?? [], + body: activationData ?? [], } return ( diff --git a/src/features/appSubscription/appSubscriptionApiSlice.ts b/src/features/appSubscription/appSubscriptionApiSlice.ts index 7e761a04a..c246bde06 100644 --- a/src/features/appSubscription/appSubscriptionApiSlice.ts +++ b/src/features/appSubscription/appSubscriptionApiSlice.ts @@ -109,12 +109,12 @@ export type SubscriptionStoreRequest = { } export type SubscriptionActivationResponse = { - technicalUserInfo: { + technicalUserInfo: Array<{ technicalUserId: string technicalUserSecret: string technicalClientId: string technicalUserPermissions: string[] - } + }> clientInfo: { clientId: string clientUrl: string @@ -170,7 +170,7 @@ export const apiSlice = createApi({ `/api/apps/${body.appId}/subscription/${body.subscriptionId}/provider`, }), addUserSubscribtion: builder.mutation< - SubscriptionActivationResponse[], + SubscriptionActivationResponse, SubscriptionStoreRequest >({ query: (data: SubscriptionStoreRequest) => ({