-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clients/web: migrate customer portal to new client
- Loading branch information
1 parent
80d0714
commit 4d14612
Showing
88 changed files
with
933 additions
and
1,837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
clients/apps/web/src/app/(main)/(topbar)/(backer)/purchases/products/[id]/ClientPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 9 additions & 14 deletions
23
clients/apps/web/src/app/(main)/(topbar)/(backer)/purchases/products/[id]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
import { getServerSideAPI } from '@/utils/api/serverside' | ||
import { CustomerOrder, ResponseError } from '@polar-sh/api' | ||
import { getServerSideAPI } from '@/utils/client/serverside' | ||
import { unwrap } from '@polar-sh/client' | ||
import { notFound } from 'next/navigation' | ||
import ClientPage from './ClientPage' | ||
|
||
export default async function Page({ params }: { params: { id: string } }) { | ||
const api = getServerSideAPI() | ||
|
||
let order: CustomerOrder | ||
|
||
try { | ||
order = await api.customerPortalOrders.get({ id: params.id }) | ||
} catch (e) { | ||
if (e instanceof ResponseError && e.response.status === 404) { | ||
notFound() | ||
} else { | ||
throw e | ||
} | ||
} | ||
const order = await unwrap( | ||
api.GET('/v1/customer-portal/orders/{id}', { | ||
params: { path: { id: params.id } }, | ||
cache: 'no-store', | ||
}), | ||
{ 404: notFound }, | ||
) | ||
|
||
return <ClientPage order={order} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...nts/apps/web/src/app/(main)/(topbar)/(backer)/purchases/subscriptions/[id]/ClientPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 15 additions & 14 deletions
29
clients/apps/web/src/app/(main)/(topbar)/(backer)/purchases/subscriptions/[id]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
import { getServerSideAPI } from '@/utils/api/serverside' | ||
import { CustomerSubscription, ResponseError } from '@polar-sh/api' | ||
import { getServerSideAPI } from '@/utils/client/serverside' | ||
import { unwrap } from '@polar-sh/client' | ||
import { notFound } from 'next/navigation' | ||
import ClientPage from './ClientPage' | ||
|
||
export default async function Page({ params }: { params: { id: string } }) { | ||
const api = getServerSideAPI() | ||
|
||
let subscription: CustomerSubscription | ||
|
||
try { | ||
subscription = await api.customerPortalSubscriptions.get({ id: params.id }) | ||
} catch (e) { | ||
if (e instanceof ResponseError && e.response.status === 404) { | ||
notFound() | ||
} else { | ||
throw e | ||
} | ||
} | ||
const subscription = await unwrap( | ||
api.GET('/v1/customer-portal/subscriptions/{id}', { | ||
params: { | ||
path: { | ||
id: params.id, | ||
}, | ||
}, | ||
cache: 'no-store', | ||
}), | ||
{ | ||
404: notFound, | ||
}, | ||
) | ||
|
||
return <ClientPage subscription={subscription} /> | ||
} |
2 changes: 1 addition & 1 deletion
2
clients/apps/web/src/app/(main)/[organization]/(header)/donate/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.