Skip to content

Commit ab27671

Browse files
committed
fix: provide an option for not showing the expired window when getting 401/403
This is a suggested temprary fix for http 401/403 error from leetcode.
1 parent 29a8b53 commit ab27671

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lua/leetcode/api/utils.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function utils.check_err(err)
151151
end
152152

153153
if err.status then
154-
if err.status == 401 or err.status == 403 then
154+
if (err.status == 401 or err.status == 403) and config.user.show_menu_when_expire then
155155
require("leetcode.command").expire()
156156
err.msg = "Session expired? Enter a new cookie to keep using `leetcode.nvim`"
157157
end

lua/leetcode/config/template.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ local M = {
127127

128128
---@type boolean
129129
image_support = false,
130+
131+
---@type boolean
132+
show_menu_when_expire = false,
130133
}
131134

132135
return M

0 commit comments

Comments
 (0)