Commit 03b85e8e authored by PDuarte's avatar PDuarte

delete fixs season, episodes

parent b250bfe9
......@@ -2,7 +2,7 @@ import { useState, useEffect, Fragment } from 'react'
import { useParams, Link } from 'react-router-dom'
// ** Store & Actions
import { getepisode, updateepisodes, deleteasset } from '../../store/actions'
import { getepisode, updateepisodes, deleteepisode } from '../../store/actions'
import { useSelector, useDispatch } from 'react-redux'
......@@ -47,7 +47,7 @@ const ElementEdit = () => {
const handelDelete = () => {
if (!confirm('Delete')) return
dispatch(
deleteasset({ ...dataElement })
deleteepisode({ ...dataElement })
)
}
// ** Function to get user on mount
......
......@@ -2,7 +2,7 @@ import { useState, useEffect, Fragment } from 'react'
import { useParams, Link } from 'react-router-dom'
// ** Store & Actions
import { getseason, updateseasons, deleteasset } from '../../store/actions'
import { getseason, updateseasons, deleteseason } from '../../store/actions'
import { useSelector, useDispatch } from 'react-redux'
......@@ -47,7 +47,7 @@ const ElementEdit = () => {
const handelDelete = () => {
if (!confirm('Delete')) return
dispatch(
deleteasset({ ...dataElement })
deleteseason({ ...dataElement })
)
}
// ** Function to get user on mount
......
......@@ -105,3 +105,24 @@ export const getData_episodes = params => {
})
}
}
export const deleteepisode = params => {
return (dispatch, getState) => {
axios
.delete(`${process.env.REACT_APP_API}${moduleSettings.apiBaseURL}/${params.id}`, params)
.then(response => {
dispatch({
type: 'GET_EPISODE',
data: null
})
})
.then(() => {
dispatch(setSaveSatus(true))
})
.catch(err => {
const errosMsg = !err.response ? 'error' : err.response.data.message
console.log(errosMsg)
dispatch(setErrorMsg(errosMsg))
})
}
}
\ No newline at end of file
......@@ -106,3 +106,23 @@ export const getData_seasons = params => {
})
}
}
export const deleteseason = params => {
return (dispatch, getState) => {
axios
.delete(`${process.env.REACT_APP_API}${moduleSettings.apiBaseURL}/${params.id}`, params)
.then(response => {
dispatch({
type: 'GET_SEASON',
data: null
})
})
.then(() => {
dispatch(setSaveSatus(true))
})
.catch(err => {
const errosMsg = !err.response ? 'error' : err.response.data.message
console.log(errosMsg)
dispatch(setErrorMsg(errosMsg))
})
}
}
\ No newline at end of file
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