瀏覽代碼

feat: cloud query object convert

fmode 18 小時之前
父節點
當前提交
f9def68c0c
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/lib/ncloud.ts

+ 6 - 1
src/lib/ncloud.ts

@@ -186,7 +186,7 @@ export class CloudQuery {
 
         if (Object.keys(this.queryParams["where"]).length) {
             const whereStr = JSON.stringify(this.queryParams["where"]);
-            url += `where=${whereStr}`;
+            url += `where=${whereStr}&limit=1`;
         }
 
         const response = await fetch(url, {
@@ -211,6 +211,11 @@ export class CloudQuery {
 
     dataToObj(exists:any):CloudObject{
         let existsObject = new CloudObject(this.className);
+        Object.keys(exists).forEach(key=>{
+          if(exists[key]?.__type =="Object"){
+            exists[key] = this.dataToObj(exists[key])
+          }
+        })
         existsObject.set(exists);
         existsObject.id = exists.objectId;
         existsObject.createdAt = exists.createdAt;