Skip to content

Commit

Permalink
fix: add getCustomerInfo judgment
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-liu-smile authored and CarlLiu2023 committed Sep 8, 2023
1 parent e962cb8 commit bea23bb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/storefront/src/utils/loginInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getBCGraphqlToken,
getUserCompany,
} from '@/shared/service/b2b'
import { getBcCurrentJWT } from '@/shared/service/bc'
import { getBcCurrentJWT, getCustomerInfo } from '@/shared/service/bc'
import { B3LStorage, B3SStorage, storeHash } from '@/utils'

const { VITE_B2B_CLIENT_ID, VITE_LOCAL_DEBUG } = import.meta.env
Expand Down Expand Up @@ -337,10 +337,16 @@ export const getCurrentCustomerInfo = async (
b2bToken?: string
) => {
try {
const loginCustomer = B3SStorage.get('loginCustomer')
let loginCustomer = B3SStorage.get('loginCustomer')

if (!loginCustomer) {
return undefined
const {
data: { customer },
} = await getCustomerInfo()

loginCustomer = customer

if (!customer) return undefined
}

const {
Expand Down

0 comments on commit bea23bb

Please sign in to comment.