-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Feature/working login page #3710
base: develop-postgres
Are you sure you want to change the base?
Feature/working login page #3710
Conversation
WalkthroughThe pull request updates documentation and code across several modules. Documentation for GraphQL query variables and TypeScript interfaces now reflects new definition line numbers. The GraphQL mutation to revoke refresh tokens has been updated to require an input parameter. In addition, components handling user logout (ProfileDropdown, SignOut, and UserNavbar) now retrieve the user ID from local storage and pass it to the mutation, and organization data mapping has been adjusted. Minor changes in session management and interface structure are also included. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant LS as LocalStorage
participant S as SignOut Component
participant API as GraphQL API
U->>S: Initiate logout
S->>LS: Retrieve userId
LS-->>S: Return userId
S->>API: Call revokeRefreshToken(input: { id: userId })
API-->>S: Return confirmation/error
S->>U: Process logout outcome
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/components/ProfileDropdown/ProfileDropdown.tsx (1)
36-49
: 🛠️ Refactor suggestionAdd error handling for missing user ID.
The logout function should validate that userId exists before attempting to revoke the token, similar to other components.
const logout = async (): Promise<void> => { try { + if (!userId) { + console.error('User ID is missing.'); + return; + } await revokeRefreshToken({ variables: { input: { id: userId },
🧹 Nitpick comments (4)
src/components/SignOut/SignOut.tsx (1)
52-58
: Consider consolidating error handling in retry logic.The retry logic duplicates the token revocation code but doesn't reuse the userId validation. This could lead to attempting token revocation with an invalid userId during retry.
if (retryRevocation) { try { + if (!userId) { + console.error('User ID is missing.'); + return; + } await revokeRefreshToken({ variables: { input: { id: userId },src/screens/LoginPage/LoginPage.tsx (3)
138-140
: Remove debug console.log statement.Remove the commented-out console.log statement as it's not needed in production code.
Apply this diff to remove the debug statement:
- // console.log(orgData.getAllOrganization,'aaaaa');
🧰 Tools
🪛 Biome (1.9.4)
[error] 138-138: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
138-138
: Use optional chaining for safer property access.Use optional chaining to safely access the
getAllOrganization
property.Apply this diff to use optional chaining:
- if (orgData && orgData.getAllOrganization) { + if (orgData?.getAllOrganization) {🧰 Tools
🪛 Biome (1.9.4)
[error] 138-138: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
147-149
: Improve string interpolation readability.The string interpolation can be made more readable by adding spaces between the organization details.
Apply this diff to improve readability:
- tempObj['label'] = - `${org.name}(${org.city},${org.state},${org.countryCode})`; - tempObj['id'] = org.id; + tempObj['label'] = `${org.name} (${org.city}, ${org.state}, ${org.countryCode})`; + tempObj['id'] = org.id;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (80)
docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_ATTENDEES.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_CHECKINS.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_DETAILS.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_FEEDBACKS.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_REGISTRANTS.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_DATA_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_MEMBERS_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_COUNT_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_CONNECTION_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/RECURRING_EVENTS.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_JOINED_ORGANIZATIONS_PG.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_FOR_TABLE.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_REQUEST.md
(1 hunks)docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md
(1 hunks)docs/docs/auto-docs/components/SignOut/SignOut/functions/default.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAddOnSpotAttendeeProps.md
(3 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAddress.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemCategoryInfo.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemCategoryList.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemInfo.md
(5 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemList.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCampaignInfo.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreateFund.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreatePledge.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreateVolunteerGroup.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCustomFieldData.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceEventVolunteerInfo.md
(3 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceFormData.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceFundInfo.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceMapType.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfacePledgeInfo.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfacePostCard.md
(5 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfacePostForm.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryBlockPageMemberListItem.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryFundCampaignsPledges.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryMembershipRequestsListItem.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationAdvertisementListItem.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationEventListItem.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationFundCampaigns.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationListObject.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationPostListItem.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationUserTags.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserListItem.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserTagChildTags.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserTagsAssignedMembers.md
(2 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserTagsMembersToAssignTo.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryVenueListItem.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceTagData.md
(4 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceUserCampaign.md
(1 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceUserEvents.md
(3 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerGroupInfo.md
(4 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerMembership.md
(3 hunks)docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerRank.md
(1 hunks)docs/docs/auto-docs/utils/useSession/functions/default.md
(1 hunks)src/GraphQl/Mutations/mutations.ts
(1 hunks)src/GraphQl/Queries/Queries.ts
(1 hunks)src/components/ProfileDropdown/ProfileDropdown.tsx
(1 hunks)src/components/SignOut/SignOut.tsx
(3 hunks)src/components/UserPortal/UserNavbar/UserNavbar.tsx
(1 hunks)src/screens/LoginPage/LoginPage.tsx
(1 hunks)src/utils/interfaces.ts
(1 hunks)src/utils/useSession.tsx
(3 hunks)
✅ Files skipped from review due to trivial changes (71)
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_REGISTRANTS.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_COUNT_PG.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS_PG.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_ATTENDEES.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_MEMBERS_PG.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md
- docs/docs/auto-docs/components/SignOut/SignOut/functions/default.md
- docs/docs/auto-docs/utils/useSession/functions/default.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_JOINED_ORGANIZATIONS_PG.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_POSTS_PG.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_FOR_TABLE.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/RECURRING_EVENTS.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_DETAILS.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemInfo.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceMapType.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_CHECKINS.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/EVENT_FEEDBACKS.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationAdvertisementListItem.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserTagsAssignedMembers.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemCategoryInfo.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemList.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_CONNECTION_LIST.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationPostListItem.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAgendaItemCategoryList.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_LIST.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationUserTags.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfacePledgeInfo.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserListItem.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAddOnSpotAttendeeProps.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceFormData.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerMembership.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceEventVolunteerInfo.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfacePostForm.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserTagChildTags.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationEventListItem.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryVenueListItem.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerRank.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceUserEvents.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_LIST_REQUEST.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceUserCampaign.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCampaignInfo.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceFundInfo.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryBlockPageMemberListItem.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreateVolunteerGroup.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreateFund.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreatePledge.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryFundCampaignsPledges.md
- docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_DATA_PG.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceTagData.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerGroupInfo.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationFundCampaigns.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceAddress.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryMembershipRequestsListItem.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCustomFieldData.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfacePostCard.md
- docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryUserTagsMembersToAssignTo.md
🧰 Additional context used
🪛 Biome (1.9.4)
src/screens/LoginPage/LoginPage.tsx
[error] 138-138: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🔇 Additional comments (11)
src/components/SignOut/SignOut.tsx (1)
32-43
: LGTM! Enhanced error handling for token revocation.The changes properly validate the user ID before attempting to revoke the refresh token, improving error handling and security.
src/components/UserPortal/UserNavbar/UserNavbar.tsx (1)
55-72
: LGTM! Well-structured async logout handling.The changes properly implement:
- Async/await pattern
- User ID validation
- Error handling
src/utils/useSession.tsx (1)
53-57
: LGTM! Improved session timeout handling.The changes properly handle the session timeout duration by using the server-provided value or falling back to the default.
src/GraphQl/Mutations/mutations.ts (1)
207-208
:✅ Verification successful
Verify that all callers have been updated to use the new input parameter.
The mutation signature has been updated to require a
RevokeRefreshTokenInput!
parameter. This is a breaking change that requires updates to all callers of this mutation.Run the following script to verify that all callers have been updated:
🏁 Script executed:
#!/bin/bash # Description: Search for all usages of the REVOKE_REFRESH_TOKEN mutation to ensure they pass the required input parameter. # Test: Search for mutation calls. Expect: All calls should include input parameter. rg -A 5 "revokeRefreshToken\("Length of output: 1892
All callers are now passing the required input parameter.
The search confirms that every usage of the
revokeRefreshToken
mutation in the following files—src/components/ProfileDropdown/ProfileDropdown.tsx
,src/components/SignOut/SignOut.tsx
,src/components/UserPortal/UserNavbar/UserNavbar.tsx
, andsrc/utils/useSession.tsx
—correctly includes the input parameter:
variables: { input: { id: userId } }
The necessary changes have been applied consistently across the codebase.
src/GraphQl/Queries/Queries.ts (1)
42-47
:✅ Verification successful
Verify that all consumers have been updated to use the new data structure.
The query has been updated to use
getAllOrganization
and return a simplified data structure with onlyid
,name
,city
,state
, andcountryCode
. This is a breaking change that requires updates to all consumers of this query.Run the following script to verify that all consumers have been updated:
🏁 Script executed:
#!/bin/bash # Description: Search for all usages of the ORGANIZATION_LIST query to ensure they handle the new data structure. # Test: Search for query usages. Expect: All consumers should handle the new fields. rg -A 5 "ORGANIZATION_LIST"Length of output: 4030
Consumers properly updated for the new data structure
The grep search confirms that all references to the
ORGANIZATION_LIST
query (and relatedUSER_ORGANIZATION_LIST
) across components, tests, and mocks are now using the updatedgetAllOrganization
structure with the simplified fields (id
,name
,city
,state
, andcountryCode
). No outdated field references appear in the results.
- src/GraphQl/Queries/Queries.ts: Query definitions now use the new structure.
- src/screens/LoginPage/LoginPage.tsx & associated test files: Consumers correctly reference the updated query.
- Mocks in OrgList and User test files: Updated to use the new query payload.
All consumers have been updated accordingly.
src/utils/interfaces.ts (1)
851-855
: LGTM! Interface changes align with the query structure.The interface has been correctly updated to match the simplified data structure returned by the
getAllOrganization
query.docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceQueryOrganizationListObject.md (5)
11-16
: Documentation for "city" Property
The "city" property is clearly documented and linked to its definition in the source file. Although this property wasn’t flagged in the PR objectives, its inclusion is clear and the type is correctly shown asstring
.
19-23
: Update for "countryCode" Property
The "countryCode" property now replaces the old "createdAt" field. The documentation correctly reflects the updated type asstring
and points to the revised source definition. Ensure that all related parts of the application now refer tocountryCode
instead ofcreatedAt
.
27-31
: Update for "id" Property
The interface documentation now presents the "id" property, which effectively consolidates the previous_id
andcreator
fields. The reference to its location in the source file is accurate. This update improves consistency across the data model.
35-39
: Update for "name" Property
The "name" property now replaces the previously used "image" field. The documentation clearly specifies its type (string
) and includes a correct source link. Verify that any components relying on the old property have been updated accordingly.
43-47
: Update for "state" Property
The "state" property in the documentation replaces the earlier "members" field and now documents a simplified type ofstring
instead of an object array. This change may have wider implications on how organization states are managed. Please verify that this design change is intentional and that any related data transformations or validations elsewhere in the application are updated accordingly.
const { getItem } = useLocalStorage(); | ||
const userId = getItem('id'); | ||
if (!userId) { | ||
console.error('User ID is missing.'); | ||
return; | ||
} | ||
await revokeRefreshToken({ | ||
variables: { | ||
input: { id: userId }, | ||
}, | ||
}); |
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.
Fix React hooks rule violation.
The useLocalStorage
hook is called inside the handleLogout
function, which violates the Rules of Hooks. Hooks must be called at the top level of the component.
const useSession = (): UseSessionReturnType => {
const { t: tCommon } = useTranslation('common');
+ const { getItem } = useLocalStorage();
let startTime: number;
let timeoutDuration: number;
const handleLogout = async (): Promise<void> => {
try {
- const { getItem } = useLocalStorage();
const userId = getItem('id');
if (!userId) {
console.error('User ID is missing.');
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const { getItem } = useLocalStorage(); | |
const userId = getItem('id'); | |
if (!userId) { | |
console.error('User ID is missing.'); | |
return; | |
} | |
await revokeRefreshToken({ | |
variables: { | |
input: { id: userId }, | |
}, | |
}); | |
const useSession = (): UseSessionReturnType => { | |
const { t: tCommon } = useTranslation('common'); | |
const { getItem } = useLocalStorage(); | |
let startTime: number; | |
let timeoutDuration: number; | |
const handleLogout = async (): Promise<void> => { | |
try { | |
const userId = getItem('id'); | |
if (!userId) { | |
console.error('User ID is missing.'); | |
return; | |
} | |
await revokeRefreshToken({ | |
variables: { | |
input: { id: userId }, | |
}, | |
}); | |
} catch (error) { | |
// Handle error appropriately | |
} | |
}; | |
// ... other code in the hook | |
}; |
|
What kind of change does this PR introduce?
feature
Issue Number:
Fixes #3236
If relevant, did you update the documentation?
N/A
Summary
-Organization is now loading and revoke refresh token is successfully calling from frontend side
Does this PR introduce a breaking change?
N/A
Checklist
CodeRabbit AI Review
Test Coverage
Other information
N/A
Have you read the contributing guide?
Yes
Summary by CodeRabbit
New Features / Improvements
Bug Fixes