Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Henrique Barbosa
Run2biz Challenge - QA
Commits
c8f80ae7
Commit
c8f80ae7
authored
2 years ago
by
Henrique Barbosa
Browse files
Options
Download
Email Patches
Plain Diff
fix: Change error message
parent
fce7327c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
project/run2biz-challenge-front/src/app/utils/errors.ts
project/run2biz-challenge-front/src/app/utils/errors.ts
+1
-3
project/run2biz-challenge-front/src/app/utils/string.ts
project/run2biz-challenge-front/src/app/utils/string.ts
+1
-5
No files found.
project/run2biz-challenge-front/src/app/utils/errors.ts
View file @
c8f80ae7
import
{
firstLetterUpperCase
}
from
"
./string
"
;
export
type
Error
=
{
fieldName
:
string
;
message
:
string
;
...
...
@@ -11,7 +9,7 @@ export function showError(errors: Error[]) {
alert
(
'
Erro!
\n
Esse e-mail já foi cadastrado por outro usuário!
'
);
}
if
(
error
.
fieldName
.
includes
(
'
cpf
'
))
{
alert
(
`Erro!\n
${
firstLetterUpperCase
(
error
.
message
)}
!`
);
alert
(
`Erro!\n
Número de CPF inválido
!`
);
}
});
}
This diff is collapsed.
Click to expand it.
project/run2biz-challenge-front/src/app/utils/string.ts
View file @
c8f80ae7
function
firstLetterUpperCase
(
str
:
string
)
{
return
str
.
replace
(
/^
\w
/
,
(
c
)
=>
c
.
toUpperCase
());
}
function
formatCpf
(
event
:
Event
)
{
let
value
=
(
event
.
target
as
HTMLInputElement
).
value
;
value
=
value
.
replace
(
/
\D
/g
,
''
);
...
...
@@ -11,4 +7,4 @@ function formatCpf(event: Event) {
(
event
.
target
as
HTMLInputElement
).
value
=
value
;
}
export
{
firstLetterUpperCase
,
formatCpf
}
export
{
formatCpf
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment