Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0ba3e84f
Commit
0ba3e84f
authored
Feb 02, 2018
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace $.ajax in username validator with axios
parent
f88fbd2d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
app/assets/javascripts/pages/sessions/new/username_validator.js
...sets/javascripts/pages/sessions/new/username_validator.js
+6
-6
No files found.
app/assets/javascripts/pages/sessions/new/username_validator.js
View file @
0ba3e84f
/* eslint-disable comma-dangle, consistent-return, class-methods-use-this, arrow-parens, no-param-reassign, max-len */
/* eslint-disable comma-dangle, consistent-return, class-methods-use-this, arrow-parens, no-param-reassign, max-len */
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
flash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
const
debounceTimeoutDuration
=
1000
;
const
debounceTimeoutDuration
=
1000
;
const
invalidInputClass
=
'
gl-field-error-outline
'
;
const
invalidInputClass
=
'
gl-field-error-outline
'
;
...
@@ -77,12 +80,9 @@ export default class UsernameValidator {
...
@@ -77,12 +80,9 @@ export default class UsernameValidator {
this
.
state
.
pending
=
true
;
this
.
state
.
pending
=
true
;
this
.
state
.
available
=
false
;
this
.
state
.
available
=
false
;
this
.
renderState
();
this
.
renderState
();
return
$
.
ajax
({
axios
.
get
(
`
${
gon
.
relative_url_root
}
/users/
${
username
}
/exists`
)
type
:
'
GET
'
,
.
then
(({
data
})
=>
this
.
setAvailabilityState
(
data
.
exists
))
url
:
`
${
gon
.
relative_url_root
}
/users/
${
username
}
/exists`
,
.
catch
(()
=>
flash
(
__
(
'
An error occurred while validating username
'
)));
dataType
:
'
json
'
,
success
:
(
res
)
=>
this
.
setAvailabilityState
(
res
.
exists
)
});
}
}
}
}
...
...
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