core-outline 1.1.11 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ const CoreOutline = ({ children, data_source_id, data_source_secret }) => {
|
|
|
13
13
|
const [location, setLocation] = useState({ latitude: null, longitude: null });
|
|
14
14
|
const [browser, setBrowser] = useState(getBrowserInfo());
|
|
15
15
|
const [appToken, setAppToken] = useState("");
|
|
16
|
-
const [sessionId, setSessionId] = useState(
|
|
16
|
+
const [sessionId, setSessionId] = useState(v4());
|
|
17
17
|
|
|
18
18
|
async function authorizeApp(data_source_id, data_source_secret) {
|
|
19
19
|
const requestOptions = {
|
|
@@ -40,8 +40,6 @@ const CoreOutline = ({ children, data_source_id, data_source_secret }) => {
|
|
|
40
40
|
}
|
|
41
41
|
useEffect(async () => {
|
|
42
42
|
await authorizeApp(data_source_id, data_source_secret);
|
|
43
|
-
let sessionId = v4();
|
|
44
|
-
setSessionId(sessionId);
|
|
45
43
|
localStorage.setItem("coreOutlineSessionId", sessionId);
|
|
46
44
|
localStorage.setItem("coreOutlineDataSourceIdId", data_source_id);
|
|
47
45
|
console.log("Session", sessionId);
|
|
@@ -242,19 +240,19 @@ const CoreOutline = ({ children, data_source_id, data_source_secret }) => {
|
|
|
242
240
|
}, []);
|
|
243
241
|
|
|
244
242
|
function saveEvents(events) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
243
|
+
const requestOptions = {
|
|
244
|
+
method: "PUT",
|
|
245
|
+
headers: {
|
|
246
|
+
"Content-Type": "application/json",
|
|
247
|
+
},
|
|
248
|
+
body: JSON.stringify(events),
|
|
249
|
+
};
|
|
250
|
+
fetch(`http://localhost:5000/generate-s3-url/${data_source_id}/${sessionId}`)
|
|
251
|
+
.then((response) => response.json())
|
|
252
|
+
.then((data) => {
|
|
253
|
+
const uploadURL = data.signed_url;
|
|
254
|
+
return fetch(uploadURL, requestOptions);
|
|
255
|
+
});
|
|
258
256
|
}
|
|
259
257
|
|
|
260
258
|
function saveEventsLocally(type = "formatted" || "raw") {
|