MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / logout

Method logout

src/lib/auth.js:101–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 }
100
101 async logout() {
102 try {
103 const res = await fetch(`${config.API_BASE}/login`, {
104 method: "DELETE",
105 });
106 if (!res.ok) {
107 throw new Error("Unable to logout.");
108 }
109 } catch (error) {
110 console.error("Error during logout:", error);
111 }
112
113 loggedInUser = null;
114 localStorage.removeItem(CACHE_USER_KEY);
115
116 try {
117 await this.#exec("logout");
118 return true;
119 } catch (error) {
120 console.error("Failed to logout.", error);
121 return false;
122 }
123 }
124
125 /**
126 * @param {boolean} forceFetch

Callers 2

index.jsFile · 0.80
runMethod · 0.80

Calls 2

#execMethod · 0.95
errorMethod · 0.45

Tested by

no test coverage detected