mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 19:31:54 +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;
|
const { isConnected } = this.props;
|
||||||
|
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
this._fetchLeaderBoard();
|
this._fetchLeaderBoard('day');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,11 @@ api.interceptors.request.use((request) => {
|
|||||||
console.log('Starting ecency Request', request);
|
console.log('Starting ecency Request', request);
|
||||||
|
|
||||||
//skip code addition is register and token refresh endpoint is triggered
|
//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
|
return request
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,8 +39,6 @@ api.interceptors.request.use((request) => {
|
|||||||
}
|
}
|
||||||
request.data.code = accessToken;
|
request.data.code = accessToken;
|
||||||
console.log('Added access token:', accessToken);
|
console.log('Added access token:', accessToken);
|
||||||
} else {
|
|
||||||
console.warn('No access token available');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
@ -301,19 +301,14 @@ export const getFragments = async () => {
|
|||||||
* ************************************
|
* ************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const getLeaderboard = (duration) =>
|
export const getLeaderboard = async (duration:'day'|'week'|'month') => {
|
||||||
api
|
try{
|
||||||
.get('/leaderboard', {
|
const response = await ecencyApi.get(`private-api/leaderboard/${duration}`)
|
||||||
params: {
|
return response.data;
|
||||||
duration,
|
} catch(error) {
|
||||||
},
|
bugsnag.notify(error)
|
||||||
})
|
}
|
||||||
.then((resp) => {
|
}
|
||||||
return resp.data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
bugsnag.notify(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
export const getActivities = (data) =>
|
export const getActivities = (data) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user