Skip to content

Commit

Permalink
Merge pull request #166 from Polygant/OC-249
Browse files Browse the repository at this point in the history
Oc 249
  • Loading branch information
botjoker authored Nov 10, 2023
2 parents e3167b4 + 766e7af commit a0c9e35
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 67 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"prettier": "^2.6.2",
"semver": "^7.3.7",
"typescript": "^4.5.4",
"vite": "^2.9.5",
"vite": "^2.9.16",
"vite-plugin-eslint": "^1.6.0",
"vue-tsc": "^0.34.7"
}
Expand Down
2 changes: 1 addition & 1 deletion src/directives/pattern.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const premadePatterns = {
email:
/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@([a-zA-Z0-9-]+(\.([a-zA-Z0-9-]+)?)?)?)?)?$/,
/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@([a-zA-Z0-9-]+\.)*([a-zA-Z0-9-]+)?)?)?$/,
};

export default {
Expand Down
12 changes: 6 additions & 6 deletions src/locales/lang/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,11 +980,11 @@ const common = {
basic: "Simple",
advanced: "Advanced",
lockedBalance: "Locked Balance",
countryNotFound: "Country not found",
countrySearch: "Start typing country name",
countryNotFound: "Country/region not found",
countrySearch: "Start typing country/region name",
buysellDescription: "Light interface for quick buying and selling",
exchangeDescription: "Professional interface for traders",
countryIncorrect: "We do not support users from this country.",
countryIncorrect: "We do not support users from this country/region.",
chooseInterfaceSubtitle: "You can always change it back",
chooseInterface: "Please Choose Interface",
invalidValueString: "Use Latin characters",
Expand All @@ -993,12 +993,12 @@ const common = {
fieldMaxLength: "Max characters: ",
requiredField: "Required field",
bdayError: "You must be at least 18 years old",
chooseCountry: "Select country",
chooseCountry: "Select country/region",
agree: "I have read and agree to the",
newspaper: "Subscribe to our Newsletter",
terms: "Terms and Conditions",
privacy: "Privacy Policy",
country: "Country of residence",
country: "Country/Region of residence",
password: "Password",
birthday: "Date of birth",
firstname: "First Name",
Expand Down Expand Up @@ -1206,7 +1206,7 @@ const common = {
modalactivcode: "Your Code confirmed!",
modalactivcodeCancel: "Your Code cancelled!",
payeeracc: "Payeer account",
qiwicountrycode: "your country code",
qiwicountrycode: "your country/region code",
qiwiexample: "Example",
amounttowww: "Receive amount",
methods: "Methods",
Expand Down
39 changes: 21 additions & 18 deletions src/mixins/getRegularNumber.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
export default {
methods: {
getRegularNumber(x) {
if (Math.abs(x) < 1.0) {
let e = parseInt(x?.toString().split("e-")[1]);
if (e) {
x *= Math.pow(10, e - 1);
x =
"0." +
new Array(e).join("0") +
x.toString().substring(x < 0 ? 3 : 2);
}
} else {
let e = parseInt(x?.toString().split("+")[1]);
if (e > 20) {
e -= 20;
x /= Math.pow(10, e);
x += new Array(e + 1).join("0");
}
getRegularNumber(n) {
let sign = +n < 0 ? "-" : "",
toStr = n.toString();
if (!/e/i.test(toStr)) {
return n;
}
return x;
let [lead, decimal, pow] = n
.toString()
.replace(/^-/, "")
.replace(/^([0-9]+)(e.*)/, "$1.$2")
.split(/e|\./);
return +pow < 0
? sign +
"0." +
"0".repeat(Math.max(Math.abs(pow) - 1 || 0, 0)) +
lead +
decimal
: sign +
lead +
(+pow >= decimal.length
? decimal + "0".repeat(Math.max(+pow - decimal.length || 0, 0))
: decimal.slice(0, +pow) + "." + decimal.slice(+pow));
},
},
};
1 change: 1 addition & 0 deletions src/modules/account/pages/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<input
id="email"
v-model="form.email"
v-pattern:email
type="text"
class="register__input"
:class="{ 'border-red': validationError.email }"
Expand Down
26 changes: 15 additions & 11 deletions src/plugins/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,30 @@ export default (app) => {
error.response?.data?.code?.code === "token_not_valid"
) {
const originalRequest = error.config;
await store.dispatch("core/refreshToken");
originalRequest.headers["Authorization"] =
"Bearer " + localStorage.getItem("token");
return app.config.globalProperties.$http(originalRequest);
try {
await store.dispatch("core/refreshToken");
originalRequest.headers["Authorization"] =
"Bearer " + localStorage.getItem("token");
return app.config.globalProperties.$http(originalRequest);
} catch (e) {
console.log(e);
}
}
const pathname = window.location.pathname;
const matchNotAuthViews = noAuthRequireRoutes.find((route) =>
pathname.startsWith(route)
);
if (pathname !== "/" && !matchNotAuthViews) {
const lastPage = router.currentRoute.value.fullPath;
if (lastPage) {
if (
error.response &&
error.response?.data?.code?.code !== "token_not_valid"
) {
if (
error.response &&
error.response?.data?.code?.code === "token_not_valid"
) {
if (lastPage) {
router.push({ name: "login", query: { redirectFrom: lastPage } });
} else {
router.push({ name: "login" });
}
} else {
router.push({ name: "login" });
}
}
}
Expand Down
9 changes: 0 additions & 9 deletions src/static/public/img/Smile.svg

This file was deleted.

3 changes: 2 additions & 1 deletion src/store/core/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,9 @@ export default {
localStorage.setItem("token", response.data.access);
localStorage.setItem("refresh_token", response.data.refresh);
})
.catch(() => {
.catch((e) => {
dispatch("logout");
return Promise.reject(e);
})
.finally(() => {
refreshTokenPromise = null;
Expand Down
47 changes: 27 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz#de2a4be678bd4d0d1ffbb86e6de779cde5999028"
integrity sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==

"@eslint-community/eslint-utils@^4.3.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==
dependencies:
eslint-visitor-keys "^3.3.0"

"@eslint/eslintrc@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.1.tgz#de0807bfeffc37b964a7d0400e0c348ce5a2543d"
Expand Down Expand Up @@ -1454,17 +1461,17 @@ eslint-plugin-prettier@^4.0.0:
dependencies:
prettier-linter-helpers "^1.0.0"

eslint-plugin-vue@^9.1.0:
version "9.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-9.4.0.tgz#31c2d9002b5bb437b351a5feffdf37c4397e5cb9"
integrity sha512-Nzz2QIJ8FG+rtJaqT/7/ru5ie2XgT9KCudkbN0y3uFYhQ41nuHEaboLAiqwMcK006hZPQv/rVMRhUIwEGhIvfQ==
eslint-plugin-vue@^9.14.1:
version "9.15.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-9.15.0.tgz#2bffe2b8a628ee438f983672a73cd89df455c461"
integrity sha512-XYzpK6e2REli100+6iCeBA69v6Sm0D/yK2FZP+fCeNt0yH/m82qZQq+ztseyV0JsKdhFysuSEzeE1yCmSC92BA==
dependencies:
eslint-utils "^3.0.0"
"@eslint-community/eslint-utils" "^4.3.0"
natural-compare "^1.4.0"
nth-check "^2.0.1"
postcss-selector-parser "^6.0.9"
semver "^7.3.5"
vue-eslint-parser "^9.0.1"
vue-eslint-parser "^9.3.0"
xml-name-validator "^4.0.0"

eslint-scope@^5.1.1:
Expand Down Expand Up @@ -2155,9 +2162,9 @@ json-stable-stringify-without-jsonify@^1.0.1:
integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==

json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
dependencies:
minimist "^1.2.0"

Expand Down Expand Up @@ -2185,9 +2192,9 @@ lilconfig@^2.0.5, lilconfig@^2.0.6:
integrity sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==

loader-utils@^1.0.2, loader-utils@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
version "1.4.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3"
integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
Expand Down Expand Up @@ -3395,10 +3402,10 @@ vite-plugin-eslint@^1.6.0:
"@types/eslint" "^8.4.5"
rollup "^2.77.2"

vite@^2.9.5:
version "2.9.15"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.9.15.tgz#2858dd5b2be26aa394a283e62324281892546f0b"
integrity sha512-fzMt2jK4vQ3yK56te3Kqpkaeq9DkcZfBbzHwYpobasvgYmP2SoAr6Aic05CsB4CzCZbsDv4sujX3pkEGhLabVQ==
vite@^2.9.16:
version "2.9.16"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.9.16.tgz#daf7ba50f5cc37a7bf51b118ba06bc36e97898e9"
integrity sha512-X+6q8KPyeuBvTQV8AVSnKDvXoBMnTx8zxh54sOwmmuOdxkjMmEJXH2UEchA+vTMps1xw9vL64uwJOWryULg7nA==
dependencies:
esbuild "^0.14.27"
postcss "^8.4.13"
Expand Down Expand Up @@ -3440,10 +3447,10 @@ vue-eslint-parser@^8.0.0:
lodash "^4.17.21"
semver "^7.3.5"

vue-eslint-parser@^9.0.1:
version "9.0.3"
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-9.0.3.tgz#0c17a89e0932cc94fa6a79f0726697e13bfe3c96"
integrity sha512-yL+ZDb+9T0ELG4VIFo/2anAOz8SvBdlqEnQnvJ3M7Scq56DvtjY0VY88bByRZB0D4J0u8olBcfrXTVONXsh4og==
vue-eslint-parser@^9.3.0:
version "9.3.1"
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-9.3.1.tgz#429955e041ae5371df5f9e37ebc29ba046496182"
integrity sha512-Clr85iD2XFZ3lJ52/ppmUDG/spxQu6+MAeHXjjyI4I1NUYZ9xmenQp4N0oaHJhrA8OOxltCVxMRfANGa70vU0g==
dependencies:
debug "^4.3.4"
eslint-scope "^7.1.1"
Expand Down

0 comments on commit a0c9e35

Please sign in to comment.