fix(SW-739): pr review fixes
This commit is contained in:
@@ -178,7 +178,6 @@ export namespace endpoints {
|
|||||||
export const reward = `${base.path.profile}/${version}/${base.enitity.Reward}`
|
export const reward = `${base.path.profile}/${version}/${base.enitity.Reward}`
|
||||||
export const redeem = `${base.path.profile}/${version}/${base.enitity.Reward}/redeem`
|
export const redeem = `${base.path.profile}/${version}/${base.enitity.Reward}/redeem`
|
||||||
export const unwrap = `${base.path.profile}/${version}/${base.enitity.Reward}/unwrap`
|
export const unwrap = `${base.path.profile}/${version}/${base.enitity.Reward}/unwrap`
|
||||||
// TODO: add surprise endpoint once available.
|
|
||||||
|
|
||||||
export function claim(rewardId: string) {
|
export function claim(rewardId: string) {
|
||||||
return `${base.path.profile}/${version}/${base.enitity.Reward}/Claim/${rewardId}`
|
return `${base.path.profile}/${version}/${base.enitity.Reward}/Claim/${rewardId}`
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export const rewardQueryRouter = router({
|
|||||||
.query(async function ({ input, ctx }) {
|
.query(async function ({ input, ctx }) {
|
||||||
getAllRewardCounter.add(1)
|
getAllRewardCounter.add(1)
|
||||||
|
|
||||||
const allApiRewards = !!env.USE_NEW_REWARDS_ENDPOINT
|
const allApiRewards = env.USE_NEW_REWARDS_ENDPOINT
|
||||||
? await getCachedAllTierRewards(ctx.serviceToken)
|
? await getCachedAllTierRewards(ctx.serviceToken)
|
||||||
: await getAllCachedApiRewards(ctx.serviceToken)
|
: await getAllCachedApiRewards(ctx.serviceToken)
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ export const rewardQueryRouter = router({
|
|||||||
getByLevelRewardCounter.add(1)
|
getByLevelRewardCounter.add(1)
|
||||||
const { level_id } = input
|
const { level_id } = input
|
||||||
|
|
||||||
const allUpcomingApiRewards = !!env.USE_NEW_REWARDS_ENDPOINT
|
const allUpcomingApiRewards = env.USE_NEW_REWARDS_ENDPOINT
|
||||||
? await getCachedAllTierRewards(ctx.serviceToken)
|
? await getCachedAllTierRewards(ctx.serviceToken)
|
||||||
: await getAllCachedApiRewards(ctx.serviceToken)
|
: await getAllCachedApiRewards(ctx.serviceToken)
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ export const rewardQueryRouter = router({
|
|||||||
if (contentStackReward) {
|
if (contentStackReward) {
|
||||||
return contentStackReward
|
return contentStackReward
|
||||||
} else {
|
} else {
|
||||||
console.error("No contentStackReward found", reward?.rewardId)
|
console.info("No contentStackReward found", reward?.rewardId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter((reward): reward is Reward => Boolean(reward))
|
.filter((reward): reward is Reward => Boolean(reward))
|
||||||
@@ -161,7 +161,7 @@ export const rewardQueryRouter = router({
|
|||||||
|
|
||||||
const { limit, cursor } = input
|
const { limit, cursor } = input
|
||||||
|
|
||||||
const isNewEndpoint = !!env.USE_NEW_REWARDS_ENDPOINT
|
const isNewEndpoint = env.USE_NEW_REWARDS_ENDPOINT
|
||||||
const endpoint = isNewEndpoint
|
const endpoint = isNewEndpoint
|
||||||
? api.endpoints.v1.Profile.Reward.reward
|
? api.endpoints.v1.Profile.Reward.reward
|
||||||
: api.endpoints.v1.Profile.reward
|
: api.endpoints.v1.Profile.reward
|
||||||
@@ -256,7 +256,7 @@ export const rewardQueryRouter = router({
|
|||||||
surprises: contentStackBaseWithProtectedProcedure.query(async ({ ctx }) => {
|
surprises: contentStackBaseWithProtectedProcedure.query(async ({ ctx }) => {
|
||||||
getCurrentRewardCounter.add(1)
|
getCurrentRewardCounter.add(1)
|
||||||
|
|
||||||
const isNewEndpoint = !!env.USE_NEW_REWARDS_ENDPOINT
|
const isNewEndpoint = env.USE_NEW_REWARDS_ENDPOINT
|
||||||
const endpoint = isNewEndpoint
|
const endpoint = isNewEndpoint
|
||||||
? api.endpoints.v1.Profile.Reward.reward
|
? api.endpoints.v1.Profile.Reward.reward
|
||||||
: api.endpoints.v1.Profile.reward
|
: api.endpoints.v1.Profile.reward
|
||||||
|
|||||||
Reference in New Issue
Block a user