#28 Fix eslint warning

This commit is contained in:
Christoph Lienhard 2021-06-25 09:22:23 +02:00
parent 4bac42f2c7
commit ce343c8c21
3 changed files with 16 additions and 29 deletions

View file

@ -13,26 +13,16 @@ export const GET_ALL_PAGE_INFO = gql`
} }
`; `;
export interface GetAllPageInfoResponse { export interface PageInfo {
allUserAppInfos: { id: string;
nodes: Array<{ rowId: string;
id: string; title: string;
rowId: string; content: string;
title: string;
content: string;
}>;
__typename: "UserAppInfosConnection";
};
} }
export interface GetPageInfoResponse { export interface GetAllPageInfoResponse {
userAppInfo(id: string): { allUserAppInfos: {
nodes: Array<{ nodes: Array<PageInfo>;
id: string;
rowId: string;
title: string;
content: string;
}>;
__typename: "UserAppInfosConnection"; __typename: "UserAppInfosConnection";
}; };
} }

View file

@ -5,6 +5,7 @@ import { useQuery } from "@apollo/client";
import { import {
GET_ALL_PAGE_INFO, GET_ALL_PAGE_INFO,
GetAllPageInfoResponse, GetAllPageInfoResponse,
PageInfo,
} from "../backend/queries/page_info"; } from "../backend/queries/page_info";
import { EditInformationField } from "./EditInformationField"; import { EditInformationField } from "./EditInformationField";
@ -38,12 +39,12 @@ export function EditInformation(
const classes = useStyles(); const classes = useStyles();
return ( return (
<div> <React.Fragment>
<Typography component={"h2"} variant="h6" gutterBottom> <Typography component={"h2"} variant="h6" gutterBottom>
Bearbeite hier die Webseiten Info-Texte für deinen Candymat: Bearbeite hier die Webseiten Info-Texte für deinen Candymat:
</Typography> </Typography>
<Paper className={classes.root}> <Paper className={classes.root}>
{infos.map((info) => { {infos.map((info: PageInfo) => {
return ( return (
<EditInformationField <EditInformationField
loggedInPersonRowId={props.loggedInPersonRowId} loggedInPersonRowId={props.loggedInPersonRowId}
@ -53,6 +54,6 @@ export function EditInformation(
); );
})} })}
</Paper> </Paper>
</div> </React.Fragment>
); );
} }

View file

@ -4,6 +4,7 @@ import { makeStyles } from "@material-ui/core/styles";
import { useMutation } from "@apollo/client"; import { useMutation } from "@apollo/client";
import { Save } from "@material-ui/icons"; import { Save } from "@material-ui/icons";
import { EDIT_INFOS, EditInfosResponse } from "../backend/mutations/page_info"; import { EDIT_INFOS, EditInfosResponse } from "../backend/mutations/page_info";
import { PageInfo } from "../backend/queries/page_info";
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
@ -23,12 +24,7 @@ const useStyles = makeStyles((theme) => ({
})); }));
interface EditInformationFieldProps { interface EditInformationFieldProps {
info: { info: PageInfo;
id: string;
rowId: string;
title: string;
content: string;
};
loggedInPersonRowId: number; loggedInPersonRowId: number;
} }
@ -42,9 +38,9 @@ export function EditInformationField(
if (loading) console.log("Loading"); if (loading) console.log("Loading");
if (error) return <p>An error occurred</p>; if (error) return <p>An error occurred</p>;
function changeInfo(e: any) { function changeInfo(e: React.ChangeEvent<HTMLTextAreaElement>) {
const changeInfoText = e.target.value; const changeInfoText = e.target.value;
setInfo(changeInfoText); setInfo({ ...info, content: changeInfoText });
} }
return ( return (