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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1c8553f2
Commit
1c8553f2
authored
Feb 01, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted notes.js to axios
parent
c09a89c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
20 deletions
+15
-20
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+15
-20
No files found.
app/assets/javascripts/notes.js
View file @
1c8553f2
...
...
@@ -16,6 +16,7 @@ import Autosize from 'autosize';
import
'
vendor/jquery.caret
'
;
// required by jquery.atwho
import
'
vendor/jquery.atwho
'
;
import
AjaxCache
from
'
~/lib/utils/ajax_cache
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
Flash
from
'
./flash
'
;
import
CommentTypeToggle
from
'
./comment_type_toggle
'
;
...
...
@@ -252,26 +253,20 @@ export default class Notes {
return
;
}
this
.
refreshing
=
true
;
return
$
.
ajax
({
url
:
this
.
notes_url
,
headers
:
{
'
X-Last-Fetched-At
'
:
this
.
last_fetched_at
},
dataType
:
'
json
'
,
success
:
(
function
(
_this
)
{
return
function
(
data
)
{
var
notes
;
notes
=
data
.
notes
;
_this
.
last_fetched_at
=
data
.
last_fetched_at
;
_this
.
setPollingInterval
(
data
.
notes
.
length
);
return
$
.
each
(
notes
,
function
(
i
,
note
)
{
_this
.
renderNote
(
note
);
});
};
})(
this
)
}).
always
((
function
(
_this
)
{
return
function
()
{
return
_this
.
refreshing
=
false
;
};
})(
this
));
axios
.
get
(
this
.
notes_url
,
{
headers
:
{
'
X-Last-Fetched-At
'
:
this
.
last_fetched_at
,
},
}).
then
(({
data
})
=>
{
const
notes
=
data
.
notes
;
this
.
last_fetched_at
=
data
.
last_fetched_at
;
this
.
setPollingInterval
(
data
.
notes
.
length
);
$
.
each
(
notes
,
(
i
,
note
)
=>
this
.
renderNote
(
note
));
this
.
refreshing
=
false
;
}).
catch
(()
=>
{
this
.
refreshing
=
false
;
});
}
/**
...
...
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