Fix form keyboard issues and sticky footers in agent screens
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { baseApi } from '../../../services/api/baseApi';
|
||||
import type { UserProfile, AccountSummary } from '../../../types/app';
|
||||
import { demoUser, demoAccounts } from '../../../constants/mockData';
|
||||
import { resolveWithMock } from '../../../services/api/serviceHelpers';
|
||||
|
||||
export const profileApi = baseApi.injectEndpoints({
|
||||
endpoints: (builder) => ({
|
||||
getProfile: builder.query<UserProfile, void>({
|
||||
queryFn: () => resolveWithMock({ mockData: demoUser }),
|
||||
providesTags: ['UserProfile'],
|
||||
}),
|
||||
updateProfile: builder.mutation<UserProfile, Partial<UserProfile>>({
|
||||
queryFn: (updates) => resolveWithMock({ mockData: { ...demoUser, ...updates } }),
|
||||
invalidatesTags: ['UserProfile'],
|
||||
}),
|
||||
getLinkedAccounts: builder.query<AccountSummary[], void>({
|
||||
queryFn: () => resolveWithMock({ mockData: demoAccounts }),
|
||||
providesTags: ['Accounts'],
|
||||
}),
|
||||
addLinkedAccount: builder.mutation<AccountSummary, Partial<AccountSummary>>({
|
||||
queryFn: (accountData) =>
|
||||
resolveWithMock({
|
||||
mockData: {
|
||||
id: `acc_${Math.random().toString(36).substr(2, 9)}`,
|
||||
type: 'Savings',
|
||||
accountHolder: demoUser.firstName + ' ' + demoUser.lastName,
|
||||
branch: 'Mumbai Main',
|
||||
maskedNumber: `XXXX ${accountData.maskedNumber?.slice(-4) || '9999'}`,
|
||||
availableBalance: 0,
|
||||
currentBalance: 0,
|
||||
currency: 'INR',
|
||||
...accountData,
|
||||
} as AccountSummary,
|
||||
}),
|
||||
invalidatesTags: ['Accounts'],
|
||||
}),
|
||||
removeLinkedAccount: builder.mutation<void, string>({
|
||||
queryFn: () => resolveWithMock({ mockData: undefined }),
|
||||
invalidatesTags: ['Accounts'],
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
export const {
|
||||
useGetProfileQuery,
|
||||
useUpdateProfileMutation,
|
||||
useGetLinkedAccountsQuery,
|
||||
useAddLinkedAccountMutation,
|
||||
useRemoveLinkedAccountMutation,
|
||||
} = profileApi;
|
||||
Reference in New Issue
Block a user