mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-17 22:27:19 +00:00
Improve login reliability by adding a small delay and preventing double submissions
Add a timeout and disable button during login submission to prevent race conditions and ensure session is established before redirect. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 279f1558-c0e3-40e4-8217-be7e9f4c6eca Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 66ef506a-aac4-473b-8dbe-fe5083a40df2 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/b984cb14-1d19-4944-922b-bc79e821ed35/279f1558-c0e3-40e4-8217-be7e9f4c6eca/yv2JYE1 Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
d9c9eb8864
commit
1a538a8085
2 changed files with 3 additions and 1 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 44 KiB |
|
|
@ -15,15 +15,17 @@ export default function Login() {
|
|||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (isLoading) return;
|
||||
|
||||
setError("");
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
await login(username, password);
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
setLocation("/admin");
|
||||
} catch (err: any) {
|
||||
setError(err.message || "Login failed");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue