Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix unauthorized json access

AykutSaracebe39c2210d1
diff --git a/src/containers/Editor/BottomBar.tsx b/src/containers/Editor/BottomBar.tsx
index 3370e330..d9d7043c 100644
--- a/src/containers/Editor/BottomBar.tsx
+++ b/src/containers/Editor/BottomBar.tsx
@@ -119,7 +119,7 @@ export const BottomBar = () => {
{hasChanges ? <AiOutlineCloudUpload /> : <AiOutlineCloudSync />}
{hasChanges ? "Unsaved Changes" : "Saved"}
</StyledBottomBarItem>
- {query.json && (
+ {data && (
<>
<StyledBottomBarItem onClick={setPrivate}>
{isPrivate ? <AiOutlineLock /> : <AiOutlineUnlock />}
diff --git a/src/store/useJson.tsx b/src/store/useJson.tsx
index 13aa5b70..5c830586 100644
--- a/src/store/useJson.tsx
+++ b/src/store/useJson.tsx
@@ -36,13 +36,17 @@ const useJson = create<JsonStates & JsonActions>()((set, get) => ({
getJson: () => get().json,
fetchJson: async jsonId => {
if (jsonId) {
- const { data } = await altogic.endpoint.get(`json/${jsonId}`);
+ const { data, errors } = await altogic.endpoint.get(`json/${jsonId}`);
- if (data) {
+ if (!errors) {
const decompressedData = decompressFromBase64(data.json);
if (decompressedData) {
useGraph.getState().setGraph(decompressedData);
- return set({ data, json: decompressedData ?? undefined, loading: false });
+ return set({
+ data: data,
+ json: decompressedData ?? undefined,
+ loading: false,
+ });
}
}
}