CrisisCleanup / crisiscleanup-4-web

Current Crisis Cleanup Web Application (Version 4) based on Vue 3. This version was launched March 10, 2023.
https://www.crisiscleanup.org/
Apache License 2.0
6 stars 2 forks source link

fix: refine OTP authentication flow and incident management #912

Closed tabiodun closed 4 months ago

tabiodun commented 4 months ago

Summary Hooks: Refactor OTP generation and token exchange in useAuth.ts. Errors: Handle 409 conflict status in errors.ts. Phone System: Add conditional checks and save functionality in PhoneSystem.vue. Phone Overlay: Remove empty variant attribute in PhoneOverlay.vue. Worksite Form: Add error handling and return values in WorksiteForm.vue. Phone Outbound: Add Axios error handling in PhoneOutbound.ts. Admin Incident Wizard: Clean up incident data handling in AdminIncidentWizard.vue. Details src/hooks/useAuth.ts

Introduce CodeResponse interface. Rename functions for better clarity. Implement OAuth2 token exchange. src/utils/errors.ts

Add 409 status case to error handling. src/pages/phone/PhoneSystem.vue

Add null checks for worksiteForm. Introduce save option in confirmation dialog. Adjust success and error notifications. src/components/phone/PhoneOverlay.vue

Simplify closeTab button by removing empty variant attribute. src/components/work/WorksiteForm.vue

Ensure methods return false on errors to improve flow control. Add success return value in the save method. src/models/PhoneOutbound.ts

Enhance error handling with Axios error integration. src/pages/admin/AdminIncidentWizard.vue

Clean up incident data before saving. Remove unnecessary fields. This commit ensures improved error handling, better user interaction, and clearer function definitions, enhancing the overall code quality and reliability.

sentry-io[bot] commented 4 months ago

šŸ” Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

šŸ“„ File: src/hooks/useAuth.ts

Function Unhandled Issue
authStore ReferenceError: Can't find variable: t <anonymous...
Event Count: 3 Affected Users: 2
authStore SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document. ...
Event Count: 1 Affected Users: 1
šŸ“„ File: src/utils/errors.ts (Click to Expand) | Function | Unhandled Issue | | :------- | :----- | | **`getErrorMessage`** | [**TypeError: Cannot read properties of undefined (reading '0')**](https://crisis-cleanup.sentry.io/issues/5402282812/?referrer=github-open-pr-bot) getErrorMessage(src/u...
`Event Count:` **1** `Affected Users:` **1** |

Did you find this useful? React with a šŸ‘ or šŸ‘Ž

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 12.85714% with 61 lines in your changes are missing coverage. Please review.

Project coverage is 15.52%. Comparing base (95c5cdc) to head (f16bdd0).

Files Patch % Lines
src/hooks/useAuth.ts 25.00% 21 Missing :warning:
src/pages/phone/PhoneSystem.vue 0.00% 14 Missing :warning:
src/pages/admin/AdminIncidentWizard.vue 0.00% 10 Missing :warning:
src/components/work/WorksiteForm.vue 0.00% 6 Missing :warning:
src/models/PhoneOutbound.ts 25.00% 6 Missing :warning:
src/utils/errors.ts 0.00% 3 Missing :warning:
src/components/phone/PhoneOverlay.vue 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #912 +/- ## ======================================= Coverage 15.52% 15.52% ======================================= Files 380 380 Lines 80803 80841 +38 Branches 848 848 ======================================= + Hits 12541 12549 +8 - Misses 68262 68292 +30 ``` | [Flag](https://app.codecov.io/gh/CrisisCleanup/crisiscleanup-4-web/pull/912/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CrisisCleanup) | Coverage Ī” | | |---|---|---| | [unitTests](https://app.codecov.io/gh/CrisisCleanup/crisiscleanup-4-web/pull/912/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CrisisCleanup) | `15.52% <12.85%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CrisisCleanup#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 4 months ago

Playwright test results

passed Ā 52 passed

Details

stats Ā 52 tests across 12 suites
duration Ā 1 minute, 42 seconds
commit Ā f16bdd0