                                 (list
                                  :status status
                                  :id (- len i)
+                                 :pos (- len i)
                                  :title (alist-get 'question__title stat)
                                  :acceptance (concat
                                               (number-to-string

(defconst leetcode--api-root (concat leetcode--base-url "/api"))
(defconst leetcode--api-all-problems (concat leetcode--api-root "/problems/all/"))
(defconst leetcode--api-graphql (concat leetcode--base-url "/graphql"))

(defun leetcode--gen-csrf-token ()
  "Knock knock, please generate the csrf token."
  (url-retrieve-synchronously leetcode--url-login))

(defun leetcode--csrf-token ()
  (let (token)
    (catch 'break
      (dolist (cur (url-cookie-retrieve leetcode--domain leetcode--cookie-localpart-separator t))
        (when (string-equal leetcode--csrftoken (aref cur 1))
          (setq token (aref cur 2))
          (throw 'break "Found the csrf token"))))
    (unless token
      (leetcode--gen-csrf-token)
      (setq token (leetcode--csrf-token)))
    token))

(defun leetcode-login (account password)
  (interactive (unless (and (boundp 'account) (boundp 'password))
                 (list (read-string "account: ")
                       (read-passwd "password: "))))
  (let* ((csrftoken (leetcode--csrf-token))
         (url-request-method "POST")
         (url-request-extra-headers (list leetcode--Referer
                                          leetcode--User-Agent
                                          leetcode--X-Requested-With
                                          (cons leetcode--X-CSRFToken csrftoken)))
         (furl-request-data (list (cons leetcode--login-csrf-key csrftoken)
                                  (cons leetcode--login-account account)

      (lambda (col size) (list col size nil))
      column-names widths))))

(defun leetcode-problems-refresh ()
  (interactive)
  (leetcode--fetch-user-and-problems)
  (let* ((column-names '(" " "#" "Problem" "Acceptance" "Difficulty"))
         (rows (let ((problems (reverse (plist-get leetcode--problems :problems)))
                     rows)
