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