From d503b614bccab2501182573e5b51b2b16297c9e8 Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Thu, 23 Mar 2023 16:18:45 -0400 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20Fix=20mirage=20data?= =?UTF-8?q?=20(#147)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/mirage/config.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index e2a31192f..a5b9a1e7d 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -659,7 +659,15 @@ function routes() { }); // storage-buckets - this.get('/storage-buckets'); + this.get( + '/storage-buckets', + ({ storageBuckets }, { queryParams: { scope_id: scopeId, recursive } }) => { + if (recursive && scopeId === 'global') { + return storageBuckets.all(); + } + return storageBuckets.where({ scopeId }); + } + ); this.get('/storage-buckets/:id'); this.del('/storage-buckets/:id'); this.patch('/storage-buckets/:id'); @@ -683,12 +691,7 @@ function routes() { ); // session recordings - this.get( - '/session-recordings', - ({ sessionRecordings }, { queryParams: { scope_id: scopeId } }) => { - return sessionRecordings.where({ scopeId }); - } - ); + this.get('/session-recordings'); this.get( '/session-recordings/:idMethod', async ({ sessionRecordings }, { params: { idMethod } }) => {