Added refresh message display #94
@@ -12,11 +12,15 @@ export default function ProductActive({productData}){
|
|||||||
const {joinRoom} = SocketContextValues() // Destructures values from socket context
|
const {joinRoom} = SocketContextValues() // Destructures values from socket context
|
||||||
const iframe = useRef()
|
const iframe = useRef()
|
||||||
|
|
||||||
|
const [refreshMsg, setRefreshMsg] = useState('')
|
||||||
|
|
||||||
const refresh = useMutation({
|
const refresh = useMutation({
|
||||||
mutationFn: (fields) => {
|
mutationFn: (fields) => {
|
||||||
return productRefreshSite(fields)
|
return productRefreshSite(fields)
|
||||||
},
|
},
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
|
setRefreshMsg(res?.data?.message)
|
||||||
|
setTimeout(()=>{setRefreshMsg('')},3000)
|
||||||
iframe.current.src += ''
|
iframe.current.src += ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -66,8 +70,13 @@ export default function ProductActive({productData}){
|
|||||||
<iframe ref={iframe} style={{borderWidth: '0px'}} src={externalUrl} width="100%" height="600" title={externalUrl}></iframe>
|
<iframe ref={iframe} style={{borderWidth: '0px'}} src={externalUrl} width="100%" height="600" title={externalUrl}></iframe>
|
||||||
</div>
|
</div>
|
||||||
<div className="p-4 ml-auto">
|
<div className="p-4 ml-auto">
|
||||||
<button type="button" onClick={handleRefresh} className="btn btn-primary">{refresh.isPending ? 'Initiating...' : 'Rebuild Site'}
|
<div className="d-flex justify-end gap-3">
|
||||||
</button>
|
{refreshMsg &&
|
||||||
|
<p className="text-success text-center">{refreshMsg}</p>
|
||||||
|
}
|
||||||
|
<button type="button" onClick={handleRefresh} className="btn btn-primary">{refresh.isPending ? 'Initiating...' : 'Rebuild Site'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user