Commit f7793f8a authored by PDuarte's avatar PDuarte

playlist reload fix

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