Skip to content

Commit

Permalink
feat: add x-client-id to aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Oct 3, 2023
1 parent 69384a0 commit 837d838
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/pages/Farm/ElasticFarmCombination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ export const ElasticFarmCombination: FC = () => {
<Trans>
Note: Farms will run in{' '}
<Text as="span" color={theme.warning}>
multiple phases
</Text>
multiple phases.
</Text>{' '}
If you haven’t harvested your rewards for ended farms, you still can access them via the{' '}
<StyledInternalLink to={`${APP_PATHS.FARMS}/${networkInfo.route}?type=${FARM_TAB.ENDED}`}>
Ended
Expand Down
5 changes: 3 additions & 2 deletions src/services/baseQueryOauth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { KyberOauth2Api } from '@kybernetwork/oauth2'
import { FetchBaseQueryArgs } from '@reduxjs/toolkit/dist/query/fetchBaseQuery'
import { BaseQueryFn, fetchBaseQuery } from '@reduxjs/toolkit/query'
import axios from 'axios'

Expand Down Expand Up @@ -33,11 +34,11 @@ const baseQueryOauth =

// same as baseQueryOauth, but has flag to revert if meet incident
export const baseQueryOauthDynamic =
({ baseUrl = '' }: { baseUrl?: string }): BaseQueryFn =>
({ baseUrl = '', ...baseFetchOption }: FetchBaseQueryArgs): BaseQueryFn =>
async (args, WebApi, extraOptions) => {
if (!args.authentication) {
// to quickly revert if meet incident
const rawBaseQuery = fetchBaseQuery({ baseUrl })
const rawBaseQuery = fetchBaseQuery({ baseUrl, ...baseFetchOption })
return rawBaseQuery(args, WebApi, extraOptions)
}
return queryWithTokenAndTracking(args, baseUrl)
Expand Down
10 changes: 9 additions & 1 deletion src/services/route/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { GetRouteParams, GetRouteResponse } from './types/getRoute'

const routeApi = createApi({
reducerPath: 'routeApi',
baseQuery: baseQueryOauthDynamic({ baseUrl: '' }),
baseQuery: baseQueryOauthDynamic({
baseUrl: '',
}),
endpoints: builder => ({
getRoute: builder.query<
GetRouteResponse,
Expand All @@ -20,6 +22,9 @@ const routeApi = createApi({
url,
params,
authentication,
headers: {
'x-client-id': 'kyberswap',
},
}),
}),
buildRoute: builder.mutation<
Expand All @@ -32,6 +37,9 @@ const routeApi = createApi({
body: payload,
signal,
authentication,
headers: {
'x-client-id': 'kyberswap',
},
}),
}),
}),
Expand Down
2 changes: 1 addition & 1 deletion src/state/farms/elasticv2/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const useFilteredFarmsV2 = (farmAddress?: string) => {
const updatedFarms = useMemo(() => {
const newFarms = farms
?.filter(farm => {
if (farm?.endTime < Date.now() / 1000) return false
if (farm?.endTime < Date.now() / 1000 || farm?.isSettled) return false
const isUserJoinThisFarm = userInfo?.find(item => item.fId === farm.fId)
if (!isUserJoinThisFarm) return false

Expand Down

0 comments on commit 837d838

Please sign in to comment.