diff --git a/src/constants/api/apiPaths.ts b/src/constants/api/apiPaths.ts index 1d66e55..17155ac 100644 --- a/src/constants/api/apiPaths.ts +++ b/src/constants/api/apiPaths.ts @@ -44,6 +44,7 @@ type PathKeys = | 'getTokensByAppId' | 'revokeTokens' | 'revokeTokensForApp' + | 'getUI' export const apiPaths: Record = { baseUrl: '/api/kkd-configuration-service', @@ -61,6 +62,7 @@ export const apiPaths: Record = { logout: '/api/admin/auth/logout', // ======= PROFILE ====== getProfile: '/api/admin/user/get_profile', + getUI: '/api/admin/user/get_design', // ======= USERS ====== getUsers: '/get_users', createUser: '/create_user', @@ -99,7 +101,7 @@ export const apiPaths: Record = { getServicesByDomainId: '/service/get_services_by_domain_id', // ======= TOKENS ====== createToken: '/token/create_token', - getTokensByAppId: '/token/get_tokens_by_app_id', + getTokensByAppId: '/token/get_tokens_by_app_id', revokeTokens: '/token/revoke_tokens', revokeTokensForApp: '/token/revoke_tokens_for_app' } diff --git a/src/stores/redusers/ActionCreators.ts b/src/stores/redusers/ActionCreators.ts index 8b249aa..e2547cf 100644 --- a/src/stores/redusers/ActionCreators.ts +++ b/src/stores/redusers/ActionCreators.ts @@ -2,11 +2,15 @@ import { createAsyncThunk } from '@reduxjs/toolkit' import { apiPaths } from '@constants/api/apiPaths.ts' -import { ProfileDataType } from '@pages/ProfilePage/profile-page.type.ts' +import { + ProfileDataType, + UIDataType +} from '@pages/ProfilePage/profile-page.type.ts' + +import { initUI } from '@utils/UIUtiles.tsx' import { apiService } from '@services/apiService.ts' - export const fetchProfile = createAsyncThunk( 'profile/fetchProfile', async (_, { rejectWithValue }) => { @@ -20,3 +24,15 @@ export const fetchProfile = createAsyncThunk( } } ) +export const fetchUI = createAsyncThunk( + 'ui/fetchUI', + async (_, { rejectWithValue }) => { + try { + const response = await apiService.post(apiPaths.getUI) + initUI(response.data) + return response.data + } catch (error) { + return rejectWithValue(error) + } + } +)