╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Logout.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
79 switch (key) { 80 .enter => { 81 try self.logout(); 82 return; 83 }, 84 .mouse => |mouse| { 85 if (inp.leftClickOn(root_focus, self.button_id, mouse)) { 86 try self.logout(); 87 return; 88 } 89 }, 90 else => {}, 91 } 92 } 93 94 fn logout(self: *View) !void { 95 self.session.data.user_id = null; 96 self.session.data.user_name = null; 97 // leave the auth tab for the page it belongs to, where the web's 98 // /logout redirect also lands 99 try self.session.navigate(self.session.data.current_page.pageRoot()); 100 } 101 102 pub fn clearGrid(self: *View) void { 103 self.center.clearGrid(); 104 } 105 106 pub fn getGrid(self: View) ?Grid { 107 return self.center.getGrid(); 108 } 109 110 pub fn getFocus(self: *View) *Focus { 111 return self.center.getFocus(); 112 } 113 114 pub fn getSelectedIndex(self: View) ?usize { 115 _ = self; 116 return 0; 117 } 118 }; 119