integrando com nova api
This commit is contained in:
parent
90791036f9
commit
6395ec170e
@ -136,14 +136,16 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
setOpenSnackError(false)
|
setOpenSnackError(false)
|
||||||
setOpenSnackSuccess(true)
|
setOpenSnackSuccess(true)
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
setLoader(true)
|
setLoader(false)
|
||||||
htmlToCSV(html, "telemetria.csv")
|
htmlToCSV(html, "telemetria.csv")
|
||||||
|
console.log('then')
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
setSend(false)
|
setSend(false)
|
||||||
setLoader(false)
|
setLoader(false)
|
||||||
setException(true)
|
setException(true)
|
||||||
setOpenSnackError(true)
|
setOpenSnackError(true)
|
||||||
setOpenSnackSuccess(false)
|
setOpenSnackSuccess(false)
|
||||||
|
console.log('catch')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
async function getChartData() {
|
async function getChartData() {
|
||||||
@ -156,9 +158,11 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
]
|
]
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
setDemRegXDemCon2(res.data.data)
|
setDemRegXDemCon2(res.data.data)
|
||||||
|
setTableData(res.data.data)
|
||||||
htmlToCSV(html, "telemetria.csv")
|
htmlToCSV(html, "telemetria.csv")
|
||||||
|
setLoader(false)
|
||||||
})
|
})
|
||||||
setLoader(true)
|
setLoader(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const [filters, setFilters] = useState()
|
const [filters, setFilters] = useState()
|
||||||
|
|||||||
@ -9,7 +9,7 @@ export async function getDemand(
|
|||||||
discretization: string
|
discretization: string
|
||||||
) {
|
) {
|
||||||
const { '@smartAuth-token': token } = parseCookies()
|
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,
|
"type": discretization,
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": `med_5min.ponto`, "value": unity},
|
{"type" : "=", "field": `med_5min.ponto`, "value": unity},
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export async function getPowerFactorData(
|
|||||||
endDate: Date,
|
endDate: Date,
|
||||||
discretization: string
|
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,
|
"type": discretization,
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "med_5min.ponto", "value": unity},
|
{"type" : "=", "field": "med_5min.ponto", "value": unity},
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export default function getAPIClient(ctx?: Pick<next.NextPageContext, 'req'> | {
|
|||||||
const { '@smartAuth-token': token } = parseCookies(ctx)
|
const { '@smartAuth-token': token } = parseCookies(ctx)
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: "https://smart-energia-api.herokuapp.com/api",
|
baseURL: "https://smartenergiaapi.klupp.com.br/api",
|
||||||
});
|
});
|
||||||
|
|
||||||
api.interceptors.request.use(config => {
|
api.interceptors.request.use(config => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user