Qr
This commit is contained in:
@ -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> =>
|
||||
|
||||
Reference in New Issue
Block a user