Skip to content

Commit

Permalink
clients/web: adapt products list queries for the new is_archived filter
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie567 committed Jul 9, 2024
1 parent 5962148 commit 3857a50
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default async function Page({
api.products.list(
{
organizationId: organization.id,
isArchived: false,
isRecurring: true,
},
{
Expand Down
1 change: 1 addition & 0 deletions clients/apps/web/src/app/[organization]/(sidebar)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export default async function Page({
api.products.list(
{
organizationId: organization.id,
isArchived: false,
isRecurring: true,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ export default async function Page({

try {
products = await api.products.list(
{ organizationId: article.organization_id, isRecurring: true },
{
organizationId: article.organization_id,
isArchived: false,
isRecurring: true,
},
cacheConfig,
)
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default async function Page({
}

const products = await api.products.list(
{ organizationId: organization.id, isRecurring: false },
{ organizationId: organization.id, isArchived: false, isRecurring: false },
{
...cacheConfig,
next: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export default async function Page({
products = await api.products.list(
{
organizationId: organization.id,
isArchived: false,
isRecurring: true,
limit: 100,
},
Expand Down
1 change: 1 addition & 0 deletions clients/apps/web/src/app/[organization]/[repo]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export default async function Page({
api.products.list(
{
organizationId: repository.organization.id,
isArchived: false,
isRecurring: true,
},
cacheConfig,
Expand Down
1 change: 1 addition & 0 deletions clients/apps/web/src/app/[organization]/subscribe/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default async function Page({
products = await api.products.list(
{
organizationId: organization.id,
isArchived: false,
isRecurring: true,
},
cacheConfig,
Expand Down
8 changes: 6 additions & 2 deletions clients/apps/web/src/app/embed/tiers.svg/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ const getHighlightedSubscriptions = async (
limit: number = 100,
): Promise<Product[]> => {
const { id: orgId } = await fetch(
`${getServerURL()}/v1/organizations/lookup?organization_name=${org}&platform=github`,
getServerURL(
`/v1/organizations/lookup?organization_name=${org}&platform=github`,
),
{ method: 'GET' },
).then((res) => res.json())

let url = `${getServerURL()}/v1/products?organization_id=${orgId}&is_recurring=true&limit=${limit}`
let url = getServerURL(
`/v1/products/?organization_id=${orgId}&is_recurring=true&is_archived=false&limit=${limit}`,
)

const response = await fetch(url, {
method: 'GET',
Expand Down
2 changes: 2 additions & 0 deletions clients/apps/web/src/hooks/queries/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const useProducts = (
api.products.list({
organizationId: organizationId ?? '',
limit,
isArchived: false,
...(parameters || {}),
}),
retry: defaultRetry,
Expand All @@ -37,6 +38,7 @@ export const useBenefitProducts = (
api.products.list({
organizationId: organizationId ?? '',
benefitId: benefitId ?? '',
isArchived: false,
limit,
}),
retry: defaultRetry,
Expand Down

0 comments on commit 3857a50

Please sign in to comment.