Profil
This commit is contained in:
@ -5,19 +5,20 @@ import useSWR from 'swr';
|
||||
|
||||
function PreviewUpload({chgFile}:{chgFile: any})
|
||||
{
|
||||
const [file, setFile] = useState('');
|
||||
const [dimensionWidth, setDimensionWidth] = useState(0);
|
||||
const [dimensionHeight, setDimensionHeight] = useState(0);
|
||||
|
||||
// const [dog, setDog] = useState<ResponseT | any>({}); // local dog not the dog in UserContext
|
||||
|
||||
const { data, error, isLoading } = useSWR(['PreviewUpload', 'SESS'], getDog );
|
||||
const { data, error, isLoading, mutate } = 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: string | undefined = "./uploads"+ data.data.picture;
|
||||
let file_loc: string | undefined = "./uploads"+ data.data.picture;
|
||||
|
||||
// setDog(data.data);
|
||||
// setFile("./uploads"+ data.data.picture);
|
||||
@ -46,7 +47,7 @@ function PreviewUpload({chgFile}:{chgFile: any})
|
||||
console.log('dimensions: ', dimensions);
|
||||
console.log('dimensions width: ', dimensions.width);
|
||||
console.log('dimensions height: ', dimensions.height);
|
||||
file = fileLoaded;
|
||||
setFile(fileLoaded);
|
||||
|
||||
chgFile(event);
|
||||
};
|
||||
@ -79,7 +80,7 @@ function PreviewUpload({chgFile}:{chgFile: any})
|
||||
/>
|
||||
<div className='prevUplImg'>
|
||||
<img
|
||||
src={file}
|
||||
src={file ? file : file_loc}
|
||||
style={{
|
||||
display: 'flex',
|
||||
border: '2px solid tomato',
|
||||
|
||||
Reference in New Issue
Block a user