Commit f7793f8a authored by PDuarte's avatar PDuarte

playlist reload fix

parent 64768c25
......@@ -24,13 +24,17 @@ const _getData_assets = params => {
}
export const getData_assets = params => {
if (!!params.idproject && params.idproject !== null) {
return _getData_assets(params)
}
const currentProject = store.getState().navbar.projectCurrent
const newparams = {
const newparams = {
...params,
idproject: !currentProject ? '%' : currentProject.value
}
return _getData_assets(newparams)
return _getData_assets(newparams)
}
export const addasset = params => {
......
......@@ -20,6 +20,7 @@ import ManageAssets from './manageassets'
// ** Store & Actions
import {resetResults} from '../../store/actions'
import { getData_pagetypes } from '../../../settings/store/actions'
import { getData_assets } from '../../../assets/store/actions'
import { getData_layoutPlaylists } from '../../../screens/store/actions'
......@@ -169,6 +170,16 @@ const handleError = (text) => {
setLayoutplaylists(screensStore.allDataLayoutPlaylists)
}, [screensStore.allDataLayoutPlaylists])
useEffect(() => {
if (dataElement !== null && (!store.allDataLayoutAssets || store.allDataLayoutAssets.length < 1)) {
dispatch(getData_assets({
start: 0,
length: 1000,
idproject: dataElement.idproject,
q: null
}))
}
}, [dataElement])
return (
<Fragment>
......
......@@ -6,7 +6,6 @@ import { Row, Col, FormGroup, Label, Input, Button } from 'reactstrap'
import { useForm } from 'react-hook-form'
import classnames from 'classnames'
import { getData_assets } from '../../../assets/store/actions'
import DataTableServerSide from '@components/datatable'
import { element } from 'prop-types'
......@@ -126,21 +125,11 @@ const ManageAssets = ({dataElement, handleChange}) => {
setavaliableAssets(filtered)
}, [selectedAssets])
useEffect(() => {
if (!store.allDataLayoutAssets || store.allDataLayoutAssets.length < 1) {
dispatch(getData_assets({
start: 0,
length: 1000,
q: null
}))
}
}, [dispatch])
useEffect(() => {
if (dataElement !== null) {
setSelectedAssets(dataElement)
}
if (dataElement !== null) {
setSelectedAssets(dataElement)
}
}, [dataElement])
return <div className="card">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment