mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 07:42:39 +02:00
feat: implement registration toggle in backend and handle disabled state in frontend
This commit is contained in:
parent
4dc5cebb94
commit
19ed0becce
4 changed files with 23 additions and 1 deletions
|
|
@ -64,6 +64,20 @@ export default function RegisterPage() {
|
|||
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok && response.status === 403) {
|
||||
const friendlyMessage =
|
||||
"Registrations are currently closed. If you need access, contact your administrator.";
|
||||
setErrorTitle("Registration is disabled");
|
||||
setError(friendlyMessage);
|
||||
toast.error("Registration is disabled", {
|
||||
id: loadingToast,
|
||||
description: friendlyMessage,
|
||||
duration: 6000,
|
||||
});
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.detail || `HTTP ${response.status}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue