Bugfix: Fixed issue with JSON marshalling/unmarshalling

This commit is contained in:
Harrison Cramer
2023-08-06 15:30:17 -04:00
parent 68f27e5dc1
commit 5f5f5d63c0
3 changed files with 26 additions and 3 deletions

View File

@@ -52,7 +52,7 @@ M.setup = function(args)
return
else
job.run_job("info", "GET", nil, function(data)
state.INFO = data
state.INFO = data.info
keymaps.set_keymap_keys(args.keymaps)
keymaps.set_keymaps()
end)

View File

@@ -20,7 +20,7 @@ M.run_job = function(endpoint, method, body, callback)
vim.defer_fn(function()
local data_ok, data = pcall(vim.json.decode, output)
if data_ok and data ~= nil then
local status = (data.status >= 200 and data.status < 300) and "success" or "error"
local status = (tonumber(data.status) >= 200 and tonumber(data.status) < 300) and "success" or "error"
if status == "success" and callback ~= nil then
callback(data)
elseif status == "success" then