fix(PublicPage): do not parse url and add parse step to address
This commit is contained in:
parent
efcff86164
commit
36181e3f7e
1 changed files with 41 additions and 37 deletions
|
@ -138,7 +138,7 @@ export default class PublicController {
|
|||
version.contacts.email = offuscate(version.contacts.email)
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'address')) {
|
||||
version.contacts.address = version.contacts.address.split('\n')
|
||||
version.contacts.address = version.contacts.address.replace('%postalsep%', ' ').split('\n')
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'phone')) {
|
||||
//let formated: any = formatPhone(version.contacts.phone)
|
||||
|
@ -154,42 +154,46 @@ export default class PublicController {
|
|||
return p
|
||||
})
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'website')) {
|
||||
if (version.contacts.website.indexOf('https://') === -1 || version.contacts.website.indexOf('https://') === -1) {
|
||||
version.contacts.website = 'http://' + version.contacts.website
|
||||
}
|
||||
try {
|
||||
let url = new URL(version.contacts.website)
|
||||
version.contacts.websiteLabel = url.hostname + (url.pathname === '/' ? '' : url.pathname)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
version.contacts.website = version.contacts.websiteLabel = "OULA, c'est pas bon :("
|
||||
}
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'facebook')) {
|
||||
try {
|
||||
version.contacts.facebookLabel = new URL(version.contacts.facebook).pathname.replace('/', '')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
version.contacts.facebook = version.contacts.facebookLabel = "OULA, c'est pas bon :("
|
||||
}
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'twitter')) {
|
||||
try {
|
||||
version.contacts.twitterLabel = new URL(version.contacts.twitter).pathname.replace('/', '')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
version.contacts.twitter = version.contacts.twitterLabel = "OULA, c'est pas bon :("
|
||||
}
|
||||
}
|
||||
if (Utils.isStrUsable(version.contacts, 'instagram')) {
|
||||
try {
|
||||
version.contacts.instagramLabel = new URL(version.contacts.instagram).pathname.replace('/', '')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
version.contacts.instagram = version.contacts.instagramLabel = "OULA, c'est pas bon :("
|
||||
}
|
||||
}
|
||||
// if (Utils.isStrUsable(version.contacts, 'website')) {
|
||||
// console.log(version.contacts.website)
|
||||
// if (version.contacts.website.indexOf('https://') === -1 || version.contacts.website.indexOf('https://') === -1) {
|
||||
// version.contacts.website = 'http://' + version.contacts.website
|
||||
// }
|
||||
// try {
|
||||
// console.log(version.contacts.website.length)
|
||||
// let url = new URL(version.contacts.website)
|
||||
// version.contacts.websiteLabel = url.hostname + url.pathname
|
||||
// console.log(url.pathname)
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.website = version.contacts.websiteLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
// console.log(version.contacts.websiteLabel)
|
||||
// }
|
||||
// if (Utils.isStrUsable(version.contacts, 'facebook')) {
|
||||
// try {
|
||||
// version.contacts.facebookLabel = new URL(version.contacts.facebook).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.facebook = version.contacts.facebookLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
// }
|
||||
// if (Utils.isStrUsable(version.contacts, 'twitter')) {
|
||||
// try {
|
||||
// version.contacts.twitterLabel = new URL(version.contacts.twitter).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.twitter = version.contacts.twitterLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
// }
|
||||
// if (Utils.isStrUsable(version.contacts, 'instagram')) {
|
||||
// try {
|
||||
// version.contacts.instagramLabel = new URL(version.contacts.instagram).pathname.replace('/', '')
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// version.contacts.instagram = version.contacts.instagramLabel = "OULA, c'est pas bon :("
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue