wappsto-blanket
Advanced tools
Comparing version 0.0.22 to 0.0.23
@@ -5,2 +5,3 @@ import { useState, useRef, useCallback, useEffect } from 'react'; | ||
import { getServiceUrl } from '../util'; | ||
import querystring from 'querystring'; | ||
import axios from 'axios'; | ||
@@ -33,14 +34,15 @@ | ||
const getLogs = useCallback(async (start, end) => { | ||
const getLogs = useCallback(async (options) => { | ||
if(!stateId){ | ||
throw new Error('stateId is not defined'); | ||
} | ||
if(!start || !end){ | ||
const cOptions = {...options}; | ||
if(!cOptions.start || !cOptions.end){ | ||
return; | ||
} | ||
if(start.constructor === Date){ | ||
start = start.toISOString(); | ||
if(cOptions.start.constructor === Date){ | ||
cOptions.start = cOptions.start.toISOString(); | ||
} | ||
if(end.constructor === Date){ | ||
end = end.toISOString(); | ||
if(cOptions.end.constructor === Date){ | ||
cOptions.end = cOptions.end.toISOString(); | ||
} | ||
@@ -54,7 +56,7 @@ if(cachedStatus.current === STATUS.IDLE){ | ||
try{ | ||
while(more && !isCanceled.current){ | ||
while(more && !isCanceled.current && !unmounted.current){ | ||
if(cachedData.current.length > 0){ | ||
start = cachedData.current[cachedData.current.length - 1].time; | ||
cOptions.start = cachedData.current[cachedData.current.length - 1].time; | ||
} | ||
const url = `${getServiceUrl('log')}/${stateId}?start=${start}&end=${end}&type=state&limit=3600`; | ||
const url = `${getServiceUrl('log')}/${stateId}?type=state&limit=3600&${querystring.stringify(cOptions)}`; | ||
const result = await axios.get(url, { | ||
@@ -61,0 +63,0 @@ headers: { "x-session": sessionId || activeSession.meta.id }, |
{ | ||
"name": "wappsto-blanket", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27472
823