mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-08 01:04:39 +08:00
fix(deltas): Use the official API to create cursors
This commit is contained in:
parent
eea25a307d
commit
c1bf8ae026
1 changed files with 5 additions and 8 deletions
|
@ -46,17 +46,14 @@ class NylasLongConnection
|
|||
cursor = atom.config.get(@_cursorKey)
|
||||
return callback(cursor) if cursor
|
||||
|
||||
stamp = Math.round(new Date().getTime() / 1000.0)
|
||||
@_api.makeRequest
|
||||
path: "/delta/generate_cursor"
|
||||
path: "/delta/latest_cursor"
|
||||
accountId: @_accountId
|
||||
method: 'POST'
|
||||
body: { "start": stamp }
|
||||
success: (json) =>
|
||||
@setCursor(json['cursor'])
|
||||
callback(json['cursor'])
|
||||
console.log("Retrieved cursor #{json['cursor']} from \
|
||||
`generate_cursor` with timestamp: #{stamp}")
|
||||
success: ({cursor}) =>
|
||||
console.log("Obtained stream cursor #{cursor}.")
|
||||
@setCursor(cursor)
|
||||
callback(cursor)
|
||||
|
||||
setCursor: (cursor) ->
|
||||
atom.config.set(@_cursorKey, cursor)
|
||||
|
|
Loading…
Reference in a new issue