From 88cf7b032b011c6249fa169e95b7c62e351ff484 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 4 Apr 2024 16:22:28 +0700 Subject: [PATCH] fix: return value --- src/stores/user/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stores/user/index.ts b/src/stores/user/index.ts index df626d7a..fc03bc55 100644 --- a/src/stores/user/index.ts +++ b/src/stores/user/index.ts @@ -183,7 +183,7 @@ const useUserStore = defineStore('api-user', () => { ) { const res = await api.post( `/user/${userId}/branch`, - { user: ([] as string[]).concat(branchId) }, + { branch: ([] as string[]).concat(branchId) }, { headers: { 'X-Session-Id': flow?.sessionId, @@ -194,9 +194,9 @@ const useUserStore = defineStore('api-user', () => { ); if (!res) return false; - if (res.status === 200) return res.data; + if (res.status >= 400) return false; - return false; + return res.data || true; } async function removeBranch( @@ -214,13 +214,13 @@ const useUserStore = defineStore('api-user', () => { 'X-Rtid': flow?.refTransactionId, 'X-Tid': flow?.transactionId, }, - data: { user: ([] as string[]).concat(branchId) }, + data: { branch: ([] as string[]).concat(branchId) }, }); if (!res) return false; - if (res.status === 200) return res.data; + if (res.status >= 400) return false; - return false; + return res.data || true; } return {