mirror of
https://github.com/Qortal/qapp-core.git
synced 2025-06-14 17:41:20 +00:00
fix refetchData
This commit is contained in:
parent
f8bb556cdd
commit
f3917ba5c5
@ -70,7 +70,6 @@ export const usePublish = (
|
||||
const fetchPublish = useCallback(
|
||||
async (
|
||||
metadataProp: QortalGetMetadata,
|
||||
returnTypeProp: ReturnType = "JSON"
|
||||
) => {
|
||||
let resourceExists = null;
|
||||
let resource = null;
|
||||
@ -179,10 +178,15 @@ export const usePublish = (
|
||||
if (hasFetched.current) return;
|
||||
if (metadata?.identifier && metadata?.name && metadata?.service) {
|
||||
hasFetched.current = true;
|
||||
fetchPublish(metadata, returnType);
|
||||
fetchPublish(metadata);
|
||||
}
|
||||
}, [metadata, returnType]);
|
||||
|
||||
const refetchData = useCallback(async ()=> {
|
||||
if(!metadata) throw new Error('usePublish is missing metadata')
|
||||
return await fetchPublish(metadata)
|
||||
}, [metadata])
|
||||
|
||||
|
||||
const deleteResource = useCallback(async (publish: QortalGetMetadata) => {
|
||||
const res = await qortalRequest({
|
||||
@ -268,7 +272,7 @@ export const usePublish = (
|
||||
error,
|
||||
resource: publish || null,
|
||||
hasResource,
|
||||
refetch: fetchPublish,
|
||||
refetch: refetchData,
|
||||
fetchPublish,
|
||||
updatePublish,
|
||||
deletePublish: deleteResource,
|
||||
|
Loading…
x
Reference in New Issue
Block a user