All jobs / Frontend / web developer
Frontend / web developer interview question · 1–3 years
A member must not see 'Transfer ownership'. An admin must.
What do you implement?
The strongest answer
Hide or disable the action for UX, and return 403 from the API with a code the UI already understands
Why it works
Exactly. Both. The hide prevents confusion; the 403 prevents curl. A shared error code keeps the message kind.
What a good answer covers
- UX hide + server 403.
- Same machine code on both.
- 'Internal' is not authz.
- Do not launder denies as 200.
Answers that fall short
- Close, but not the strongest: Only the 403; the button can stay and fail
A button that always fails is a defect, not a permission model. - Weak: Only the hide; the endpoint is 'internal'
Internal is not a security control. It is a comment. - Red flag: Return 200 and `{ ok: false }` so the network tab looks healthy
A fake 200 breaks every client and every alert that trusts status.
Who gets asked this
More Frontend / web developer questions
- When is useMemo worth it?
- Why wrap a handler in useCallback?
- The team argues whether a field is `userId` or `user_id`. What is OpenAPI for here?
- When does React.memo help, and when does it not?
- The register API can fail because the email is taken or because the password is too short. What should the UI…
- The app feels sluggish when typing in one field. How do you find the cause?
- Where should state live, as a rule?
- Why do teams use a server-state library instead of useEffect plus useState for data?