Skip to content

Commit

Permalink
Fix billing logic to only load if logged in as a user
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite committed Oct 30, 2024
1 parent 0fef0fa commit 89baec8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/scenes/billing/billingLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const billingLogic = kea<billingLogicType>([
setComputedDiscount: (discount: number) => ({ discount }),
}),
connect(() => ({
values: [featureFlagLogic, ['featureFlags'], preflightLogic, ['preflight']],
values: [featureFlagLogic, ['featureFlags'], preflightLogic, ['preflight'], userLogic, ['user']],
actions: [
userLogic,
['loadUser'],
Expand Down Expand Up @@ -690,9 +690,11 @@ export const billingLogic = kea<billingLogicType>([
}
},
})),
afterMount(({ actions }) => {
actions.loadBilling()
actions.getInvoices()
afterMount(({ actions, values }) => {
if (values.user) {
actions.loadBilling()
actions.getInvoices()
}
}),
urlToAction(({ actions }) => ({
// IMPORTANT: This needs to be above the "*" so it takes precedence
Expand Down

0 comments on commit 89baec8

Please sign in to comment.