Skip to content

Commit

Permalink
Merge pull request #362 from paytaca/fix/p2p-exchange
Browse files Browse the repository at this point in the history
Fix Invalid Token Error
  • Loading branch information
joemarct authored Aug 7, 2024
2 parents ab1d4c4 + 2b0fafe commit a6ef5b0
Show file tree
Hide file tree
Showing 37 changed files with 485 additions and 88 deletions.
10 changes: 7 additions & 3 deletions src/components/ramp/appeal/AppealDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export default {
this.contractBalance = balance
resolve(balance)
})
.catch(error => reject(error))
.catch(error => { reject(error) })
})
},
async onSubmit () {
Expand All @@ -287,8 +287,12 @@ export default {
})
.catch(error => {
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
vm.sendingBch = true
Expand Down
1 change: 1 addition & 0 deletions src/components/ramp/appeal/AppealFeedbackDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default {
}
} else {
console.error(error)
bus.emit('network-error')
}
})
.finally(() => { vm.loading = false })
Expand Down
8 changes: 6 additions & 2 deletions src/components/ramp/appeal/AppealIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,12 @@ export default {
.catch(error => {
console.error(error)
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
},
Expand Down
8 changes: 6 additions & 2 deletions src/components/ramp/appeal/AppealListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ export default {
})
.catch(error => {
console.error(error?.response)
if (error?.response?.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error?.response?.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
},
Expand Down
18 changes: 13 additions & 5 deletions src/components/ramp/appeal/AppealProcess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,12 @@ export default {
})
.catch(error => {
console.error(error?.response)
if (error?.response?.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error?.response?.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
reject(error)
})
Expand All @@ -227,9 +231,13 @@ export default {
resolve(response.data)
})
.catch(error => {
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
console.error(error.response)
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
this.loading = false
if (done) done()
Expand Down
7 changes: 6 additions & 1 deletion src/components/ramp/appeal/AppealProfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export default {
}
} else {
console.error(error)
bus.emit('network-error')
}
})
.finally(() => {
Expand All @@ -260,7 +261,11 @@ export default {
await vm.$store.dispatch('ramp/fetchUser')
})
} catch (error) {
console.error(error?.response || error)
if (error.response) {
console.error(error?.response)
} else {
bus.emit('network-error')
}
}
this.editNickname = false
},
Expand Down
23 changes: 21 additions & 2 deletions src/components/ramp/appeal/AppealSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import { getDarkModeClass } from 'src/utils/theme-darkmode-utils'
import ConfirmationDialog from './ConfirmationDialog.vue'
import { backend } from 'src/wallet/ramp/backend'
import { bus } from 'src/wallet/event-bus.js'
export default {
data () {
Expand Down Expand Up @@ -123,7 +124,16 @@ export default {
this.inactiveFor = inactiveFor
resolve(response.data)
})
.catch((error) => { reject(error) })
.catch((error) => {
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
reject(error)
})
})
},
onSetActive () {
Expand Down Expand Up @@ -161,7 +171,16 @@ export default {
this.$emit('setInactive')
this.$emit('back')
})
.catch((error) => { console.error(error?.response) })
.catch((error) => {
console.error(error?.response)
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
},
editName () {
this.readOnlyState = false
Expand Down
2 changes: 2 additions & 0 deletions src/components/ramp/appeal/AppealTransfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export default {
}
} else {
console.error(error)
bus.emit('network-error')
}
})
},
Expand All @@ -197,6 +198,7 @@ export default {
vm.errorMessage = error.response?.data?.error
} else {
console.error(error)
bus.emit('network-error')
}
vm.hideBtn = false
})
Expand Down
10 changes: 8 additions & 2 deletions src/components/ramp/fiat/AdListings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ export default {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
},
Expand All @@ -324,8 +326,12 @@ export default {
})
.catch(error => {
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
},
Expand Down
40 changes: 30 additions & 10 deletions src/components/ramp/fiat/AddPaymentMethods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,12 @@ export default {
})
.catch(error => {
console.error(error.response || error)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
},
Expand All @@ -439,8 +443,12 @@ export default {
})
.catch(error => {
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
},
Expand All @@ -465,8 +473,12 @@ export default {
await backend.delete(`/ramp-p2p/payment-method/${index}`, { authorize: true })
.catch(error => {
console.error(error.response || error)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
await vm.fetchPaymentMethods()
Expand Down Expand Up @@ -501,8 +513,12 @@ export default {
.catch(error => {
console.error(error.response || error)
vm.openDialog = false
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
Expand All @@ -519,8 +535,12 @@ export default {
.catch(error => {
console.error(error.response)
vm.savingPaymentMethod = false
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
})
break
Expand Down
8 changes: 6 additions & 2 deletions src/components/ramp/fiat/DisplayConfirmation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ export default {
console.log(response)
} catch (error) {
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
}
}
Expand Down
20 changes: 16 additions & 4 deletions src/components/ramp/fiat/EscrowTransfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ export default {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
reject(error)
})
Expand Down Expand Up @@ -371,8 +373,12 @@ export default {
})
.catch(error => {
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
vm.loading = false
reject(error)
Expand All @@ -395,8 +401,12 @@ export default {
})
.catch(error => {
console.error(error.response)
if (error.response && error.response.status === 403) {
bus.emit('session-expired')
if (error.response) {
if (error.response.status === 403) {
bus.emit('session-expired')
}
} else {
bus.emit('network-error')
}
vm.loading = false
reject(error)
Expand Down Expand Up @@ -468,6 +478,7 @@ export default {
}
} else {
console.error(error)
bus.emit('network-error')
}
reject(error)
})
Expand All @@ -488,6 +499,7 @@ export default {
}
} else {
console.error(error)
bus.emit('network-error')
}
reject(error)
})
Expand Down
Loading

0 comments on commit a6ef5b0

Please sign in to comment.