fix bug in NewTicket Form

This commit is contained in:
Ruidy Nemausat 2020-04-20 16:18:16 +02:00
parent c3dca8edef
commit 14bb8af68c
8 changed files with 10 additions and 16 deletions

BIN
app.db

Binary file not shown.

View file

@ -11,7 +11,6 @@ import ProjectCard from "../Cards/ProjectCard";
import FloatingButton from "../Buttons/FloatingButton";
import NewProjectModal from "../Modals/NewProjectModal";
import Project from "../../types/Project";
import User from "../../types/User";
const useStyles = makeStyles((theme: Theme) =>
createStyles({

View file

@ -1,12 +1,8 @@
import React, { FC, useState, FormEvent } from "react";
import { TextField } from "@material-ui/core";
import Modal from "./Modal";
import Project from "../../types/Project";
import User from "../../types/User";
import { post } from "../../utils/http";
import Constants from "../../utils/Constants";
import { useAuth0 } from "../../authentication/auth0";
import { ProjectService } from "../../services";
import Modal from "./Modal";
interface IProps {
show: boolean;

View file

@ -35,9 +35,9 @@ const NewTicketModal: FC<IProps> = ({ show, handleClose, allProjects }) => {
const { url } = useRouteMatch();
const id = url.split("/")[2];
const [projectId, setProjectId] = useState(id);
const [categoryID, setCategoryID] = useState(0);
const [impactID, setImpactID] = useState(0);
const [difficultyID, setDifficultyID] = useState(0);
const [categoryID, setCategoryID] = useState(1);
const [impactID, setImpactID] = useState(1);
const [difficultyID, setDifficultyID] = useState(1);
const { getTokenSilently, user } = useAuth0();
const handleSubmit = async (e: FormEvent) => {
@ -157,7 +157,7 @@ const NewTicketModal: FC<IProps> = ({ show, handleClose, allProjects }) => {
className={classes.select}
>
{Category.map((c: string, i: number) => (
<MenuItem key={i} value={i}>
<MenuItem key={i} value={i + 1}>
{c}
</MenuItem>
))}
@ -178,7 +178,7 @@ const NewTicketModal: FC<IProps> = ({ show, handleClose, allProjects }) => {
margin="normal"
>
{Impact.map((c: string, i: number) => (
<MenuItem key={i} value={i}>
<MenuItem key={i} value={i + 1}>
{c}
</MenuItem>
))}
@ -199,7 +199,7 @@ const NewTicketModal: FC<IProps> = ({ show, handleClose, allProjects }) => {
margin="normal"
>
{Difficulty.map((c: string, i: number) => (
<MenuItem key={i} value={i}>
<MenuItem key={i} value={i + 1}>
{c}
</MenuItem>
))}

View file

@ -6,7 +6,6 @@ import ProjectList from "../Lists/ProjectList";
import TicketList from "../Lists/TicketList";
import Ticket from "../../types/Ticket";
import Project from "../../types/Project";
import User from "../../types/User";
interface TabProps {
children?: ReactNode;

View file

@ -72,7 +72,7 @@ const ProjectController: FC = () => {
setHasError(true);
setError("Bad Request");
}
}, [id]);
}, [id, getTokenSilently]);
if (hasError) {
return <ErrorController error={error} />;

View file

@ -38,7 +38,7 @@ const TicketController: FC = () => {
setHasError(true);
setError("Bad Request");
}
}, [id]);
}, [id, getTokenSilently]);
if (hasError) {
return <ErrorController error={error} />;

View file

@ -40,7 +40,7 @@ const UserController: FC = () => {
setHasError(true);
setError("Bad Request");
}
}, [id]);
}, [id, getTokenSilently]);
if (hasError) {
return <ErrorController error={error} />;