Skip to content

Commit 52a8483

Browse files
justjuanguijustjuangui
andauthored
POE Api: Logout from api (#1092)
Co-authored-by: justjuangui <servicios@juacarvajal.com>
1 parent ff76d4a commit 52a8483

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Classes/ImportTab.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
2828
self.controls.charImportStatusLabel = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 14, 200, 16}, function()
2929
return "^7Character import status: "..(type(self.charImportStatus) == "function" and self.charImportStatus() or self.charImportStatus)
3030
end)
31+
32+
self.controls.logoutApiButton = new("ButtonControl", {"TOPLEFT",self.controls.charImportStatusLabel,"TOPRIGHT"}, {4, 0, 200, 16}, "^7Logout from Path of Exile API", function()
33+
main.lastToken = nil
34+
self.api.authToken = nil
35+
main.lastRefreshToken = nil
36+
self.api.refreshToken = nil
37+
main.tokenExpiry = nil
38+
self.api.tokenExpiry = nil
39+
main:SaveSettings()
40+
self.charImportMode = "AUTHENTICATION"
41+
self.charImportStatus = colorCodes.WARNING.."Not authenticated"
42+
end)
43+
self.controls.logoutApiButton.shown = function()
44+
return self.charImportMode == "SELECTCHAR" and self.api.authToken ~= nil
45+
end
3146

3247
self.controls.characterImportAnchor = new("Control", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 40, 200, 16})
3348
self.controls.sectionCharImport.height = function() return self.charImportMode == "AUTHENTICATION" and 60 or 200 end

0 commit comments

Comments
 (0)