-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Generalize user preferences as per resource kind #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
export const USER_PREFERENCES_ATTRIBUTE_KEY = 'userPreferences' | ||
|
||
export const PreferredResourceKinds: PreferredResourceKindType[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls move to UPPER_CASE and can we make object since that will be type safe if new type is added
const parsedResourcesMap: UserPreferencesType['resources'] = {} | ||
|
||
PreferredResourceKinds.forEach((resourceKind) => { | ||
parsedResourcesMap[resourceKind] = resources?.[resourceKind] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls add fallback
} | ||
} | ||
|
||
/** | ||
* @description This function updates the user preferences in the server. It constructs a payload with the updated user preferences and sends a PATCH request to the server. If the request is successful, it returns true. If an error occurs, it shows an error message and returns false. | ||
* @param updatedUserPreferences - The updated user preferences to be sent to the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls fix the comment
Description
Context switcher implementation for
Type of change
Checklist