-
Notifications
You must be signed in to change notification settings - Fork 35
permission request button for led sign page #1990
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: LED4MEMBERS
Are you sure you want to change the base?
Conversation
…into Request-Button4LEDSIGN
|
you spelled permission wrong |
src/Pages/LedSign/LedSign.js
Outdated
| }, []) | ||
|
|
||
| if (loading) { | ||
| if (loading || checkingPermission) { |
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 can skip the second checkingPermission check, so the page loads as soon as the healthcheck is done
renderPermissionRequestUI can have the checkingPermission check instead, and it can have some small message like "loading", and then fade in the result (requested already or not yet)
| if (res.ok) { | ||
| const data = await res.json(); | ||
| status.responseData = Array.isArray(data) && data.length > 0 ? data[0] : null; | ||
| } else if (res.status === 404) { | ||
| status.responseData = null; | ||
| } else { | ||
| status.error = true; | ||
| } |
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.
this should work
| if (res.ok) { | |
| const data = await res.json(); | |
| status.responseData = Array.isArray(data) && data.length > 0 ? data[0] : null; | |
| } else if (res.status === 404) { | |
| status.responseData = null; | |
| } else { | |
| status.error = true; | |
| } | |
| status.error = !!res.ok; | |
| if (res.ok) { | |
| const data = await res.json(); | |
| status.responseData = Array.isArray(data) && data.length > 0 ? data[0] : null; | |
| } |
| if (res.ok) { | ||
| // Backend sends 200 with no body on success, so fetch the created request | ||
| const existingRequest = await getPermissionRequest(type, token); | ||
| status.responseData = existingRequest.responseData; | ||
| } else if (res.status === 409) { | ||
| // If conflict, fetch the existing request | ||
| const existingRequest = await getPermissionRequest(type, token); | ||
| status.responseData = existingRequest.responseData; | ||
| } else { | ||
| status.error = true; | ||
| } |
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.
would this work
| if (res.ok) { | |
| // Backend sends 200 with no body on success, so fetch the created request | |
| const existingRequest = await getPermissionRequest(type, token); | |
| status.responseData = existingRequest.responseData; | |
| } else if (res.status === 409) { | |
| // If conflict, fetch the existing request | |
| const existingRequest = await getPermissionRequest(type, token); | |
| status.responseData = existingRequest.responseData; | |
| } else { | |
| status.error = true; | |
| } | |
| status.error = !!res.ok; | |
| if (res.ok || res.status === 409) { | |
| // Backend sends 200 with no body on success, so fetch the created request | |
| const existingRequest = await getPermissionRequest(type, token); | |
| status.responseData = existingRequest.responseData; | |
| } |
src/Pages/LedSign/LedSign.js
Outdated
| <p className="text-sm text-gray-600 dark:text-gray-400 italic"> | ||
| Drop a message in Discord to speed up the process | ||
| </p> |
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.
| <p className="text-sm text-gray-600 dark:text-gray-400 italic"> | |
| Drop a message in Discord to speed up the process | |
| </p> |

step 2