Merge branch 'telemetry' into 'dev'

integrando com nova api

See merge request kluppsoftware/smart-energia-web!127
This commit is contained in:
José Corte 2022-07-26 19:53:36 +00:00
commit eb5904939a
4 changed files with 9 additions and 5 deletions

View File

@ -136,14 +136,16 @@ export default function Telemetria({userName, clients}: any) {
setOpenSnackError(false)
setOpenSnackSuccess(true)
setOpen(false)
setLoader(true)
setLoader(false)
htmlToCSV(html, "telemetria.csv")
console.log('then')
}).catch(res => {
setSend(false)
setLoader(false)
setException(true)
setOpenSnackError(true)
setOpenSnackSuccess(false)
console.log('catch')
})
}
async function getChartData() {
@ -156,9 +158,11 @@ export default function Telemetria({userName, clients}: any) {
]
}).then(res => {
setDemRegXDemCon2(res.data.data)
setTableData(res.data.data)
htmlToCSV(html, "telemetria.csv")
setLoader(false)
})
setLoader(true)
setLoader(false)
}
const [filters, setFilters] = useState()

View File

@ -9,7 +9,7 @@ export async function getDemand(
discretization: string
) {
const { '@smartAuth-token': token } = parseCookies()
const { data } = await api.post('https://smart-energia-api.herokuapp.com/api/telemetry/demand', {
const { data } = await api.post('/telemetry/demand', {
"type": discretization,
"filters": [
{"type" : "=", "field": `med_5min.ponto`, "value": unity},

View File

@ -8,7 +8,7 @@ export async function getPowerFactorData(
endDate: Date,
discretization: string
) {
const { data } = await api.post('http://smart-energia-api.herokuapp.com/api/telemetry/powerFactor', {
const { data } = await api.post('/telemetry/powerFactor', {
"type": discretization,
"filters": [
{"type" : "=", "field": "med_5min.ponto", "value": unity},

View File

@ -13,7 +13,7 @@ export default function getAPIClient(ctx?: Pick<next.NextPageContext, 'req'> | {
const { '@smartAuth-token': token } = parseCookies(ctx)
const api = axios.create({
baseURL: "https://smart-energia-api.herokuapp.com/api",
baseURL: "https://smartenergiaapi.klupp.com.br/api",
});
api.interceptors.request.use(config => {