disable login button whilst logging in
This commit is contained in:
parent
7ae822f115
commit
a092b4e9c8
2 changed files with 12 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ RUN npm ci
|
|||
# Copy all files and build
|
||||
COPY . .
|
||||
|
||||
RUN npm run build # TODO: MOVE ME BELOW
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { login } from '@/auth/authService';
|
||||
import { Button } from "@/components/ui/button";
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from './ui/dialog';
|
||||
|
||||
interface ModalProps {
|
||||
|
|
@ -11,6 +11,7 @@ const Modal: React.FC<ModalProps> = ({
|
|||
isOpen,
|
||||
}) => {
|
||||
if (!isOpen) return null;
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
|
||||
return (
|
||||
<Dialog open={isOpen}>
|
||||
|
|
@ -20,7 +21,15 @@ const Modal: React.FC<ModalProps> = ({
|
|||
<DialogTitle>Login to Wrongmove</DialogTitle>
|
||||
</DialogHeader>
|
||||
<DialogFooter>
|
||||
<Button onClick={login}>Login</Button>
|
||||
{isLoading && (
|
||||
<div>Signing in. Please wait...</div>
|
||||
)
|
||||
}
|
||||
<Button onClick={
|
||||
() => {
|
||||
setIsLoading(true)
|
||||
login()
|
||||
}} disabled={isLoading}>Login</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue