Refactor filterData function to use destructuring assignment
This commit is contained in:
parent
3cae5bcee9
commit
0ea9140e6b
@ -257,7 +257,7 @@ const resetData = () => {
|
|||||||
const filterData = async (params: any) => {
|
const filterData = async (params: any) => {
|
||||||
resetData()
|
resetData()
|
||||||
const dateValue = params.periode.split(' s/d ')
|
const dateValue = params.periode.split(' s/d ')
|
||||||
const { posko, idUid, idUp3 } = params
|
const { posko, uid, up3 } = params
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
dateFrom: dateValue[0]
|
dateFrom: dateValue[0]
|
||||||
@ -266,8 +266,8 @@ const filterData = async (params: any) => {
|
|||||||
dateTo: dateValue[1]
|
dateTo: dateValue[1]
|
||||||
? dateValue[1].split('-').reverse().join('-')
|
? dateValue[1].split('-').reverse().join('-')
|
||||||
: new Date().toISOString().slice(0, 10),
|
: new Date().toISOString().slice(0, 10),
|
||||||
idUid: idUid ? idUid.id : 0,
|
idUid: uid ? uid.id : 0,
|
||||||
idUp3: idUp3 ? idUp3.id : 0,
|
idUp3: up3 ? up3.id : 0,
|
||||||
idPosko: posko ? posko.id : 0
|
idPosko: posko ? posko.id : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ const resetData = () => {
|
|||||||
const filterData = async (params: any) => {
|
const filterData = async (params: any) => {
|
||||||
resetData()
|
resetData()
|
||||||
const dateValue = params.periode.split(' s/d ')
|
const dateValue = params.periode.split(' s/d ')
|
||||||
const { posko, idUid, idUp3 } = params
|
const { posko, uid, up3 } = params
|
||||||
const query = {
|
const query = {
|
||||||
dateFrom: dateValue[0]
|
dateFrom: dateValue[0]
|
||||||
? dateValue[0].split('-').reverse().join('-')
|
? dateValue[0].split('-').reverse().join('-')
|
||||||
@ -206,8 +206,8 @@ const filterData = async (params: any) => {
|
|||||||
dateTo: dateValue[1]
|
dateTo: dateValue[1]
|
||||||
? dateValue[1].split('-').reverse().join('-')
|
? dateValue[1].split('-').reverse().join('-')
|
||||||
: new Date().toISOString().slice(0, 10),
|
: new Date().toISOString().slice(0, 10),
|
||||||
idUid: idUid ? idUid.id : 0,
|
idUid: uid ? uid.id : 0,
|
||||||
idUp3: idUp3 ? idUp3.id : 0,
|
idUp3: up3 ? up3.id : 0,
|
||||||
posko: posko ? posko.id : 0
|
posko: posko ? posko.id : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user