This commit is contained in:
Peter Hoppe
2023-02-03 16:33:35 +01:00
parent 3b4ea00378
commit a55bdfc775
9 changed files with 371 additions and 355 deletions

View File

@ -1,6 +1,5 @@
import React, { useState } from 'react';
import { ResponseT } from '../context/UserContext';
import {Axios, getDog} from '../services/PhpApi';
import {getDog} from '../services/PhpApi';
import useSWR from 'swr';
function PreviewUpload({chgFile}:{chgFile: any})
@ -11,19 +10,14 @@ function PreviewUpload({chgFile}:{chgFile: any})
// const [dog, setDog] = useState<ResponseT | any>({}); // local dog not the dog in UserContext
const { data, error, isLoading, mutate } = useSWR(['PreviewUpload', 'SESS'], getDog );
const { data, error, isLoading } = useSWR(['PreviewUpload', 'SESS'], getDog );
if (error) return (<div>failed to load</div>);
if (isLoading) return (<div>loading...</div>);
console.log('PreviewUpload getDog');
console.log(data);
const dog: ResponseT | any = data.data;
let file_loc: string | undefined = "./uploads"+ data.data.picture;
// setDog(data.data);
// setFile("./uploads"+ data.data.picture);
const handleChange = async (
event: React.ChangeEvent<HTMLInputElement>
): Promise<any> =>