-
Notifications
You must be signed in to change notification settings - Fork 14
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
Notifications: wiring and integration with API #318
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/aragon/court-dashboard/bk10y5r6m |
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.
My last comment builds off of #316. I'm understanding how everything is hooked up, but still think we could improve where the logic lives and how to create good abstractions around it.
In terms of moving forward, should we merge all the other PRs, then merge development
into this PR, and continue working off of it?
@@ -0,0 +1,3 @@ | |||
export const UNAUTHORIZED_RESPONSE = 401 |
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.
We may prefer using https://www.npmjs.com/package/http-status-codes
<React.Fragment> | ||
{!fetching && ( | ||
<Modal | ||
width={Math.min(76 * GU, width - 40)} |
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.
width={Math.min(76 * GU, width - 40)} | |
width={Math.min(76 * GU, width - 5 * GU)} |
src/services/servicesRequests.js
Outdated
.join(', ') | ||
|
||
return { | ||
needsSignature: |
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.
It looks like these error and authentication validation bits could be taken out and abstracted into a function, e.g.
function notificationsApi(req) {
const rawResponse = await req()
if (!rawResponse.ok) {
const errors = jsonResponse.errors
.map(err => Object.values(err).join(', '))
.join(', ')
return {
needsSignature:
rawResponse.status === UNAUTHORIZED_RESPONSE ||
rawResponse.status === USER_NOT_FOUND ||
rawResponse.status === FORBIDDEN_RESPONSE,
error: errors,
}
}
return rawResponse
}
src/components/GlobalPreferences/Notifications/NotificationsManager.js
Outdated
Show resolved
Hide resolved
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.
🙌🙌🙌 I think we've squashed the bugs and we're good to go!
would love a bit more of testing from our folks? did you guys have a chance to try it? |
…#337) * testing ref * Global preferences: Animate Notifications Box height (#336) * Email notifications manager: Animate Box height * Screens: Adjust padding and margins * unnecessary margin on preferences mode Co-authored-by: Rodrigo Perez <rodrigopi1989@gmail.com> * Email: prevent same email address to be updated Co-authored-by: Fabrizio Vigevani <fabriziovigevani@gmail.com>
* Use Input hook and screens refactors * Change URL endpoint for the services
Working branch for better review and deployment