Merge pull request 'double click after registering (fix #121)' (#129) from survey/doubleclickprevention into main

Reviewed-on: #129
This commit is contained in:
cami 2021-07-11 00:42:28 +00:00
commit bf7af89c78
4 changed files with 16 additions and 7 deletions

View file

@ -13,8 +13,11 @@ import Secret from "./components/pages/Secret";
import Umfrage from "./components/pages/Umfrage"; import Umfrage from "./components/pages/Umfrage";
import PrivateRoute from "./auth/PrivateRoute"; import PrivateRoute from "./auth/PrivateRoute";
import Behavior from "./components/pages/Behavior"; import Behavior from "./components/pages/Behavior";
import { useAuth } from "./auth/AuthProvider";
function App() { function App() {
const [isLoggedIn] = useAuth();
isLoggedIn ? (document.title = isLoggedIn) : document.title = isLoggedIn;
return ( return (
<> <>
<Router> <Router>

View file

@ -8,7 +8,7 @@ export default function Behavior() {
let logger = new Logger({ let logger = new Logger({
//inputs: ["cursor", "wheel", "keyboard", "touch"], //inputs: ["cursor", "wheel", "keyboard", "touch"],
inputs: ["keyboard"], inputs: ["keyboard"],
logToConsole: true, // logToConsole: true,
}); });
logger.init(); logger.init();
@ -19,10 +19,10 @@ export default function Behavior() {
console.log(isLoggedIn); console.log(isLoggedIn);
if (isLoggedIn === false) { if (isLoggedIn === false) {
logger.stop(); logger.stop();
console.log("stopped logger"); //console.log("stopped logger");
} else { } else {
logger.start(); logger.start();
console.log("start logger"); // console.log("start logger");
} }
}); });
return ( return (

View file

@ -34,7 +34,7 @@ export default function Umfrage() {
const [isSkillsOk, setIsSkillsOk] = useState(""); const [isSkillsOk, setIsSkillsOk] = useState("");
/* genereal check if survey is valid */ /* genereal check if survey is valid */
const [isSurveyValid, setIsSurveyValid] = useState(""); const [isSurveyValid, setIsSurveyValid] = useState(true);
const onSubmitClick = (e) => { const onSubmitClick = (e) => {
e.preventDefault(); e.preventDefault();
@ -49,11 +49,14 @@ export default function Umfrage() {
setIsGenderOk(true); setIsGenderOk(true);
setIsEducationOk(true); setIsEducationOk(true);
setIsSkillsOk(true); setIsSkillsOk(true);
setIsSurveyValid(true);
console.log("before valid");
console.log(isSurveyValid);
if (!Number(age)) { if (!Number(age)) {
setAgeErrorMessage("Das Alter muss als Zahl angegeben werden."); setAgeErrorMessage("Das Alter muss als Zahl angegeben werden.");
setIsSurveyValid(false); //setIsSurveyValid(false);
setIsAgeOk(false); // setIsAgeOk(false);
} }
if (gender === "DEFAULT" || gender === "") { if (gender === "DEFAULT" || gender === "") {
setGenderErrorMessage( setGenderErrorMessage(
@ -77,7 +80,8 @@ export default function Umfrage() {
setIsSkillsOk(false); setIsSkillsOk(false);
} }
setIsSurveyValid(true); console.log("after valid");
console.log(isSurveyValid);
if (isSurveyValid === true) { if (isSurveyValid === true) {
authFetch("/api/protected/umfrage", { authFetch("/api/protected/umfrage", {
method: "post", method: "post",

View file

@ -13,6 +13,8 @@ export default function Lizenzen() {
Bildnachweise notiert werden. Bildnachweise notiert werden.
</p> </p>
<h2>Verwendete Bibliotheken</h2> <h2>Verwendete Bibliotheken</h2>
<h3>Backend</h3>
<h3>Frontend</h3>
<h2>Bildnachweise</h2> <h2>Bildnachweise</h2>
<ul className="bildnachweise"> <ul className="bildnachweise">
<li> <li>