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 {