Bunch of contract updates
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {RawSubscriptionObject} from '#/state/purchases/subscriptions/api/types'
|
||||
import {EntitlementId} from '#/state/purchases/subscriptions/types'
|
||||
|
||||
export async function getMainSubscriptions({
|
||||
did,
|
||||
@@ -13,10 +14,31 @@ export async function getMainSubscriptions({
|
||||
|
||||
if (!res.ok) {
|
||||
console.error('error fetching subscriptions', res.status, await res.text())
|
||||
return {
|
||||
active: [],
|
||||
available: [],
|
||||
}
|
||||
}
|
||||
|
||||
const json = await res.json()
|
||||
|
||||
return json as {
|
||||
active: RawSubscriptionObject[]
|
||||
available: RawSubscriptionObject[]
|
||||
}
|
||||
}
|
||||
|
||||
export async function getEntitlements({did}: {did: string}) {
|
||||
const res = await fetch(
|
||||
`https://bsky-purchases.ngrok.io/entitlements?user=${did}`,
|
||||
)
|
||||
|
||||
if (!res.ok) {
|
||||
console.error('error fetching entitlements', res.status, await res.text())
|
||||
return []
|
||||
}
|
||||
|
||||
const {subscriptions} = await res.json()
|
||||
const {entitlements} = await res.json()
|
||||
|
||||
return subscriptions as RawSubscriptionObject[]
|
||||
return entitlements as {id: EntitlementId}[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user