Skip to content

Commit

Permalink
Merge pull request #1711 from /issues/1710
Browse files Browse the repository at this point in the history
twitter,github expired accesstoken error handled
  • Loading branch information
varsha766 authored Oct 12, 2022
2 parents 6033293 + 2f91b5b commit 57b65ff
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/components/participant/Action.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,24 @@ export default {
return this.notifyErr(Messsages.ACTIONS.SOME_ERROR);
}
} catch (e) {
this.notifyErr(e.message);
// console.log(e);
if(e.status === 401){
switch(actionItem.type){
case "TWITTER_FOLLOW":
case "TWITTER_RETWEET": {
localStorage.removeItem("twitterAccessToken")
return this.notifyErr(Messsages.EVENT_ACTIONS.TWITTER_AUTH_AGAIN)
}
case "GITHUB_PR":{
localStorage.removeItem("githubAccessToken")
return this.notifyErr(Messsages.EVENT_ACTIONS.GITHUB_PR.AUTH_AGAIN)
}
}
} else {
this.notifyErr(e.message);
}
}
finally{
this.isLoading = false;
}
},
},
Expand Down
4 changes: 3 additions & 1 deletion src/mixins/apiClientMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class APICalls {
response.response.status >= 400 &&
response.response.status < 500)
) {

if(response.response.status === 401){
return response.response
}
return response.response.data || new Error("BAD REQUEST: Please check your request")
}

Expand Down
4 changes: 3 additions & 1 deletion src/utils/messages/participants/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const EVENT_ACTIONS = {
WENT_WRONG: "Something Went Wrong",
ERROR: "Error occurred: ",
ALREADY_AUTHERIZED:"You are already authorized. Please proceed to perform action.",
TWITTER_AUTH_AGAIN:"Authentication failed Please authorize Twitter again",
INPUT_DATE: {
INVALID_DATE_TIME: "Invalid date time"
},
Expand Down Expand Up @@ -56,7 +57,8 @@ const EVENT_ACTIONS = {
GITHUB_PR:{
GITHUB_AUTH:"Please authorize and give GitHub PR URL",
GITHUB_PR_EMPTY:"Please Enter your GitHub PR URL",
INVALID_GITHUB_PR_URL:"Invalid GitHub PR URL"
INVALID_GITHUB_PR_URL:"Invalid GitHub PR URL",
AUTH_AGAIN: "Authentication failed Please authorize GitHub again"
},
ETH: {
INVALIDWEB3: "Web3 provider not found. Please install Metamask wallet",
Expand Down

0 comments on commit 57b65ff

Please sign in to comment.