Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
fix: trim space from input fields
Browse files Browse the repository at this point in the history
  • Loading branch information
habib-deriv committed Feb 4, 2024
1 parent dce0d97 commit 2b82bbc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/pages/signup-affiliates/utils/_utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export const customSlugify = (text: string): string => {
.replace(/'/g, '')
.replace(/--+/g, '-')
}
export const trimOnly = (text: string): string => {
return text.trim()
}

export const Submit = ({
is_online,
affiliate_account,
Expand All @@ -36,22 +40,22 @@ export const Submit = ({
})
} else
affiliateSend({
email: affiliate_account.email,
email: trimOnly(affiliate_account.email),
type_of_account: affiliate_account.account_type,
commission_plan: affiliate_account.account_plan,
country: affiliate_account.account_address.country.symbol,
address_city: affiliate_account.account_address.city,
address_city: trimOnly(affiliate_account.account_address.city),
address_postcode: affiliate_account.account_address.postal_code,
address_state: customSlugify(affiliate_account.account_address.state.name),
address_street: affiliate_account.account_address.street,
first_name: affiliate_account.account_details.first_name,
last_name: affiliate_account.account_details.last_name,
address_street: trimOnly(affiliate_account.account_address.street),
first_name: trimOnly(affiliate_account.account_details.first_name),
last_name: trimOnly(affiliate_account.account_details.last_name),
date_of_birth: affiliate_account.account_details.date_birth?.toISOString().slice(0, 10),
over_18_declaration: 1,
website_url: affiliate_account.account_details?.website_url.includes('www.')
? affiliate_account.account_details?.website_url
: `www.${affiliate_account.account_details?.website_url}`,
user_name: affiliate_account.account_details.username,
user_name: trimOnly(affiliate_account.account_details.username),
password: affiliate_account.account_details.password,
phone: affiliate_account.account_details.phone,
phone_code: Number(affiliate_account.account_details.phone.substring(1, 4)),
Expand Down

0 comments on commit 2b82bbc

Please sign in to comment.