Skip to content

Commit

Permalink
- Fixed currency switching for whmcs products
Browse files Browse the repository at this point in the history
  • Loading branch information
639852 committed Aug 8, 2023
1 parent 36c9a7b commit 00df121
Show file tree
Hide file tree
Showing 5 changed files with 308 additions and 255 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"ant-design-vue": "^1.5.4",
"axios": "^1.2.1",
"core-js": "^3.26.0",
"infinimesh-proto": "^1.0.1",
"js-cookie": "^3.0.1",
"latest-version": "^6.0.0",
"markdown-it": "^13.0.1",
Expand Down
7 changes: 6 additions & 1 deletion src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ const api = new Api(VUE_APP_BASE_URL);
api.axios.interceptors.response.use(
(response) => response,
(error) => {
if (error.response && [2, 7].includes(error.response?.data?.code)) {
if (
error.response && (
error.response?.data?.code === 7 ||
error.response?.data.message === 'Token is expired'
)
) {
console.log('credentials are not actual');
vuex.dispatch("nocloud/auth/logout")
}
Expand Down
23 changes: 20 additions & 3 deletions src/components/appMain/appHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@

<script>
import { mapActions, mapGetters, mapMutations } from "vuex";
import { createPromiseClient } from "@bufbuild/connect";
import { HandsfreeService } from "infinimesh-proto/build/es/handsfree/handsfree_connect";
import { ConnectionRequest } from "infinimesh-proto/build/es/handsfree/handsfree_pb";
import balance from "@/components/balance/balance.vue";
import moment from "moment";
Expand Down Expand Up @@ -259,10 +262,24 @@ export default {
{
name: "support_telegram",
icon: "telegram",
onClickFuncion: () => {
onClickFuncion: async () => {
const { token } = this.$store.state.nocloud.auth;
window.open(`https://t.me/nocloud_telegram_bot?start=${token}`, '_blank')
const { transport } = this.$store.state.nocloud.chats;
const handsfree = createPromiseClient(HandsfreeService, transport);
try {
const stream = handsfree.connect(new ConnectionRequest({ appId: token }));
for await (const event of stream) {
console.log(event);
}
} catch (error) {
this.$notification.error({
message: this.$t(error.response?.data?.message ?? error.message ?? error)
});
}
// window.open(`https://t.me/nocloud_telegram_bot?start=${token}`, '_blank');
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/components/services/iaas/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ export default {
computed: {
getProducts() {
if (Object.keys(this.products).length == 0) return "NAN"
const product = this.products.find(({ id }) => id === +this.$route.query.product) ??
const findedProduct = this.products.find(({ id }) => id === +this.$route.query.product) ??
this.products[this.sizes.indexOf(this.options.size)]
const product = { ...findedProduct }

if (typeof product.description !== 'string') return product
if (/<\/?[a-z][\s\S]*>/i.test(product.description)) {
Expand Down
Loading

0 comments on commit 00df121

Please sign in to comment.