24 lines
673 B
TypeScript
24 lines
673 B
TypeScript
import axios from "axios"
|
|
import { parseCookies } from "nookies"
|
|
|
|
export async function getPowerFactorData(
|
|
unity: string,
|
|
startDate: string,
|
|
endDate: string,
|
|
discretization: string
|
|
) {
|
|
const { '@smartAuth-token': token } = parseCookies()
|
|
console.log(token.replace(/"/g, ''))
|
|
const { data } = await axios.post('https://smart-energia-api.herokuapp.com/api/telemetry/powerFactor', {
|
|
"filters": [
|
|
{"type" : "=", "field": "med_5min.ponto", "value": "PRAXCUENTR101P"},
|
|
{"type" : "between", "field": "dia_num", "value": ["2022-01-01", "2022-01-31"]}
|
|
]
|
|
}, {
|
|
headers: {
|
|
'Authorization': `Bearer ${token}`
|
|
}
|
|
})
|
|
return data.data
|
|
}
|