From b04ef652842f611dccabd6b278a327de994f6d30 Mon Sep 17 00:00:00 2001 From: answershuto Date: Wed, 2 Aug 2023 14:32:07 +0800 Subject: [PATCH] feat: modify getItem --- packages/cache-canvas/src/index.tsx | 4 ++-- packages/cache-canvas/src/storage.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cache-canvas/src/index.tsx b/packages/cache-canvas/src/index.tsx index 51f2733ab8..82b57d3795 100644 --- a/packages/cache-canvas/src/index.tsx +++ b/packages/cache-canvas/src/index.tsx @@ -157,8 +157,8 @@ export const CacheCanvas = forwardRef((props: CacheCanvasProps, ref) => { if (canIUse) { const res = window.__megability_bridge__.syncCall('userKVStorage', 'getItem', { key: '${cacheKey}' }); - if (res && res.statusCode === 0 && res.data) { - base64Data = res.data; + if (res && res.statusCode === 0 && res.data && res.data.result) { + base64Data = res.data.result; } } } diff --git a/packages/cache-canvas/src/storage.tsx b/packages/cache-canvas/src/storage.tsx index 43b5ef492f..3e03ab8f01 100644 --- a/packages/cache-canvas/src/storage.tsx +++ b/packages/cache-canvas/src/storage.tsx @@ -47,8 +47,8 @@ export const Storage = { if (canIUse) { const res = window.__megability_bridge__.syncCall('userKVStorage', 'getItem', { key }); - if (res && res.statusCode === 0 && res.data) { - return res.data; + if (res && res.statusCode === 0 && res.data && res.data.result) { + return res.data.result; } } }