fix phone imports

This commit is contained in:
Dobromir Popov
2024-02-28 22:26:42 +02:00
parent ea0cfeb0db
commit 4d4f912644
3 changed files with 5 additions and 2 deletions

2
.env
View File

@ -16,6 +16,8 @@ DATABASE_PROVIDER=mysql
DATABASE_URL=mysql://root:Zelen0ku4e@192.168.0.10:3306/cart_dev DATABASE_URL=mysql://root:Zelen0ku4e@192.168.0.10:3306/cart_dev
# DATABASE_URL=mysql://cart:cartpw@20.101.62.76:3307/cart # DATABASE_URL=mysql://cart:cartpw@20.101.62.76:3307/cart
#DATABASE_URL=mysql://cart:cartpw@localhost:3306/cart # migrate deploy #dev
APPLE_ID= APPLE_ID=
APPLE_TEAM_ID= APPLE_TEAM_ID=
APPLE_PRIVATE_KEY= APPLE_PRIVATE_KEY=

View File

@ -10,6 +10,7 @@ SSL_ENABLED=true
SSL_KEY=./certificates/localhost-key.pem SSL_KEY=./certificates/localhost-key.pem
SSL_CERT=./certificates/localhost.pem SSL_CERT=./certificates/localhost.pem
DATABASE_URL=mysql://root:Zelen0ku4e@192.168.0.10:3306/cart_dev # DATABASE_URL=mysql://root:Zelen0ku4e@192.168.0.10:3306/cart_dev
DATABASE_URL=mysql://cart:cartpw@localhost:3306/cart
TELEGRAM_BOT=true TELEGRAM_BOT=true

View File

@ -155,7 +155,7 @@ export default function ImportPage() {
//phone = phone.replace(/(?!^\+)\D/g, ''); //phone = phone.replace(/(?!^\+)\D/g, '');
phone = phone.replace(/[^+\d]/g, ''); phone = phone.replace(/[^+\d]/g, '');
if (phone.startsWith('8') || phone.startsWith('9')) { if (phone.startsWith('8') || phone.startsWith('9')) {
phone = '+359' + phone.substring(1); // Assumes all numbers starting with 8 are Bulgarian and should have +359 phone = '+359' + phone
} else if (!phone.startsWith('+')) { } else if (!phone.startsWith('+')) {
phone = '+' + phone; // Add + if it's missing, assuming the number is complete phone = '+' + phone; // Add + if it's missing, assuming the number is complete
} }