-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom fields route and use for custom fields mixin
- Loading branch information
1 parent
c0c835e
commit 4a291bc
Showing
11 changed files
with
100 additions
and
7 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/widgets/user-profile-widget/src/lib/widget/api/apiPaths.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const apiPaths = { | ||
user: { | ||
me: '/v1/auth/me', | ||
customAttributes: '/v1/mgmt/user/customattributes', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/widgets/user-profile-widget/src/lib/widget/api/sdk/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...ages/widgets/user-profile-widget/src/lib/widget/state/asyncActions/getCustomAttributes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* eslint-disable no-param-reassign */ | ||
/* eslint-disable @typescript-eslint/no-shadow */ | ||
import { createAsyncThunk } from '@reduxjs/toolkit'; | ||
import { Sdk } from '../../api/sdk'; | ||
import { FirstParameter, State, ThunkConfigExtraApi } from '../types'; | ||
import { buildAsyncReducer, withRequestStatus } from './helpers'; | ||
|
||
const action = createAsyncThunk< | ||
any, | ||
FirstParameter<Sdk['user']['getCustomAttributes']>, | ||
ThunkConfigExtraApi | ||
>('customAttributes', (arg, { extra: { api } }) => | ||
api.user.getCustomAttributes(), | ||
); | ||
|
||
const reducer = buildAsyncReducer(action)( | ||
{ | ||
onFulfilled: (state, action) => { | ||
state.customAttributes.data = action.payload; | ||
}, | ||
}, | ||
withRequestStatus((state: State) => state.customAttributes), | ||
); | ||
|
||
export const getCustomAttributes = { action, reducer }; |
1 change: 1 addition & 0 deletions
1
packages/widgets/user-profile-widget/src/lib/widget/state/asyncActions/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './getMe'; | ||
export * from './logout'; | ||
export * from './getCustomAttributes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/widgets/user-profile-widget/src/lib/widget/state/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters