Merge remote-tracking branch 'upstream/nt/tweaks' into nt/tweaks

This commit is contained in:
Nouman Tahir 2021-03-19 15:39:49 +05:00
commit f78b4d8b0a
2 changed files with 54 additions and 16 deletions

View File

@ -324,7 +324,7 @@
"set_new": "Set new PIN",
"write_again": "Write again",
"forgot_text": "Oh, I forgot it...",
"pin_not_matched":"Pins do not match, Please try again.",
"pin_not_matched":"PIN do not match, Please try again.",
"attempts_postfix":"failed attempt(s)",
"message_reset_warning":"User data will be wiped on next failed attempt"
},

View File

@ -29,7 +29,11 @@ export const getCurrencyTokenRate = (currency, token) =>
/**
* @params username
*/
export const getDrafts = (username) => api.get(`/drafts/${username}`).then((resp) => resp.data);
export const getDrafts = (username) =>
api
.get(`/drafts/${username}`)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
/*export const getDrafts = data =>
new Promise((resolve, reject) => {
@ -114,7 +118,8 @@ export const addBookmark = (username, author, permlink) =>
permlink,
chain: 'hive',
})
.then((resp) => resp.data);
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
export const addReport = (url) =>
api
@ -127,7 +132,10 @@ export const addReport = (url) =>
* @params current username
*/
export const getBookmarks = (username) =>
api.get(`/bookmarks/${username}`).then((resp) => resp.data);
api
.get(`/bookmarks/${username}`)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
/**
* @params id
@ -139,14 +147,20 @@ export const removeBookmark = (username, id) => api.delete(`/bookmarks/${usernam
* @params current username
*/
export const getFavorites = (username) =>
api.get(`/favorites/${username}`).then((resp) => resp.data);
api
.get(`/favorites/${username}`)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
/**
* @params current username
* @params target username
*/
export const getIsFavorite = (targetUsername, currentUsername) =>
api.get(`/isfavorite/${currentUsername}/${targetUsername}`).then((resp) => resp.data);
api
.get(`/isfavorite/${currentUsername}/${targetUsername}`)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
/**
* @params current username
@ -158,7 +172,8 @@ export const addFavorite = (currentUsername, targetUsername) =>
username: currentUsername,
account: targetUsername,
})
.then((resp) => resp.data);
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
/**
* @params current username
@ -171,7 +186,10 @@ export const removeFavorite = (currentUsername, targetUsername) =>
* @params current username
*/
export const getSnippets = (username) =>
api.get(`/fragments/${username}`).then((resp) => resp.data);
api
.get(`/fragments/${username}`)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
/**
* @params current username
@ -185,7 +203,8 @@ export const addSnippet = (currentUsername, title, body) =>
title,
body,
})
.then((resp) => resp.data);
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
/**
* @params current username
@ -413,10 +432,14 @@ export const schedule = (
options,
reblog: 0,
})
.then((resp) => resp.data);
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
export const getSchedules = (username) =>
api.get(`/schedules/${username}`).then((resp) => resp.data);
api
.get(`/schedules/${username}`)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
export const removeSchedule = (username, id) => api.delete(`/schedules/${username}/${id}`);
@ -425,7 +448,11 @@ export const moveSchedule = (id, username) => api.put(`/schedules/${username}/${
// Old image service
// Images
export const getImages = (username) => api.get(`api/images/${username}`).then((resp) => resp.data);
export const getImages = (username) =>
api
.get(`api/images/${username}`)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
export const addMyImage = (user, url) =>
api.post('/image', {
@ -467,11 +494,14 @@ export const getNodes = () => serverList.get().then((resp) => resp.data.hived ||
export const getSCAccessToken = (code) =>
new Promise((resolve, reject) => {
ecencyApi
.post('/hs-token-refresh', {
.post('/auth-api/hs-token-refresh', {
code,
})
.then((resp) => resolve(resp.data))
.catch((e) => reject(e));
.catch((e) => {
bugsnag.notify(e);
reject(e);
});
});
export const getPromotePosts = () => {
@ -479,11 +509,16 @@ export const getPromotePosts = () => {
console.log('Fetching promoted posts');
return api.get('/promoted-posts?limit=10').then((resp) => resp.data);
} catch (error) {
bugsnag.notify(error);
return error;
}
};
export const purchaseOrder = (data) => api.post('/purchase-order', data).then((resp) => resp.data);
export const purchaseOrder = (data) =>
api
.post('/purchase-order', data)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));
export const getPostReblogs = (data) =>
api
@ -492,4 +527,7 @@ export const getPostReblogs = (data) =>
.catch((error) => bugsnag.notify(error));
export const register = (data) =>
api.post('/signup/account-create', data).then((resp) => resp.data);
api
.post('/signup/account-create', data)
.then((resp) => resp.data)
.catch((error) => bugsnag.notify(error));