mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 10:52:16 +03:00
migrated leaderboard api
This commit is contained in:
parent
3463b55fcb
commit
e98c83cf0f
@ -34,7 +34,7 @@ class LeaderboardContainer extends PureComponent {
|
||||
const { isConnected } = this.props;
|
||||
|
||||
if (isConnected) {
|
||||
this._fetchLeaderBoard();
|
||||
this._fetchLeaderBoard('day');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,11 @@ api.interceptors.request.use((request) => {
|
||||
console.log('Starting ecency Request', request);
|
||||
|
||||
//skip code addition is register and token refresh endpoint is triggered
|
||||
if(request.url === '/signup/account-create' || request.url === '/auth-api/hs-token-refresh'){
|
||||
if(request.url === '/signup/account-create'
|
||||
|| request.url === '/auth-api/hs-token-refresh'
|
||||
|| request.url.startsWith('private-api/leaderboard')
|
||||
|
||||
){
|
||||
return request
|
||||
}
|
||||
|
||||
@ -35,8 +39,6 @@ api.interceptors.request.use((request) => {
|
||||
}
|
||||
request.data.code = accessToken;
|
||||
console.log('Added access token:', accessToken);
|
||||
} else {
|
||||
console.warn('No access token available');
|
||||
}
|
||||
|
||||
return request;
|
||||
|
@ -301,19 +301,14 @@ export const getFragments = async () => {
|
||||
* ************************************
|
||||
*/
|
||||
|
||||
export const getLeaderboard = (duration) =>
|
||||
api
|
||||
.get('/leaderboard', {
|
||||
params: {
|
||||
duration,
|
||||
},
|
||||
})
|
||||
.then((resp) => {
|
||||
return resp.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
bugsnag.notify(error);
|
||||
});
|
||||
export const getLeaderboard = async (duration:'day'|'week'|'month') => {
|
||||
try{
|
||||
const response = await ecencyApi.get(`private-api/leaderboard/${duration}`)
|
||||
return response.data;
|
||||
} catch(error) {
|
||||
bugsnag.notify(error)
|
||||
}
|
||||
}
|
||||
|
||||
export const getActivities = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
|
Loading…
Reference in New Issue
Block a user