Skip to content

Commit

Permalink
fix logout
Browse files Browse the repository at this point in the history
  • Loading branch information
apierantonio committed Dec 20, 2024
1 parent 039f88a commit 4344f54
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"files": {
"main.css": "./static/css/main.eaf3e493.css",
"main.js": "./static/js/main.8056056f.js",
"main.js": "./static/js/main.a359f6ab.js",
"main.css.map": "./static/css/main.eaf3e493.css.map",
"main.js.map": "./static/js/main.8056056f.js.map",
"main.js.map": "./static/js/main.a359f6ab.js.map",
"index.html": "./index.html",
"static/media/style.scss": "./static/media/toggle-on.a35a28df.svg",
"static/media/bootstrap-icons.css": "./static/media/bootstrap-icons.b7bcc075.woff2",
Expand All @@ -16,6 +16,6 @@
},
"entrypoints": [
"static/css/main.eaf3e493.css",
"static/js/main.8056056f.js"
"static/js/main.a359f6ab.js"
]
}
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en" style="height:100%;width:100%"><head><meta charset="utf-8"/><link rel="icon" href="./logo.png"/><script src="https://unpkg.com/[email protected]/dist/boxicons.js"></script><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>JJodel</title><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Anton&family=Inter+Tight:ital,wght@0,100..900;1,100..900&family=Lekton:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet"><link href="./static/css/main.eaf3e493.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="./static/js/main.8056056f.js"></script></body></html>
<!doctype html><html lang="en" style="height:100%;width:100%"><head><meta charset="utf-8"/><link rel="icon" href="./logo.png"/><script src="https://unpkg.com/[email protected]/dist/boxicons.js"></script><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>JJodel</title><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Anton&family=Inter+Tight:ital,wght@0,100..900;1,100..900&family=Lekton:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet"><link href="./static/css/main.eaf3e493.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="./static/js/main.a359f6ab.js"></script></body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -394970,7 +394970,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _data_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/data/api.ts");
/* harmony import */ var _data_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/data/storage.ts");
/* harmony import */ var _joiner__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/joiner/index.ts");
class AuthApi{static async login(email,password){_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].write('offline','false');return await _data_api__WEBPACK_IMPORTED_MODULE_0__["default"].post("".concat(_data_api__WEBPACK_IMPORTED_MODULE_0__["default"].persistance,"/auth/login"),{email,password});}static async register(name,surname,country,affiliation,newsLetter,nickname,email,password){_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].write('offline','false');return await _data_api__WEBPACK_IMPORTED_MODULE_0__["default"].post("".concat(_data_api__WEBPACK_IMPORTED_MODULE_0__["default"].persistance,"/auth/register"),{name,surname,country,affiliation,newsLetter,nickname,email,password});}static async logout(){if(!_joiner__WEBPACK_IMPORTED_MODULE_2__["U"].isOffline())await _data_api__WEBPACK_IMPORTED_MODULE_0__["default"].delete("".concat(_data_api__WEBPACK_IMPORTED_MODULE_0__["default"].persistance,"/auth/logout"));_joiner__WEBPACK_IMPORTED_MODULE_2__["U"].resetState();}static offline(){_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].write('offline','true');const user=_joiner__WEBPACK_IMPORTED_MODULE_2__["DUser"].new('Offline','User','Unknown','Unknown','Unknown',false,'Unknown','Unknown',"Pointer_OfflineUser");//`Pointer${Date.now()}_OfflineUser`);
class AuthApi{static async login(email,password){_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].write('offline','false');return await _data_api__WEBPACK_IMPORTED_MODULE_0__["default"].post("".concat(_data_api__WEBPACK_IMPORTED_MODULE_0__["default"].persistance,"/auth/login"),{email,password});}static async register(name,surname,country,affiliation,newsLetter,nickname,email,password){_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].write('offline','false');return await _data_api__WEBPACK_IMPORTED_MODULE_0__["default"].post("".concat(_data_api__WEBPACK_IMPORTED_MODULE_0__["default"].persistance,"/auth/register"),{name,surname,country,affiliation,newsLetter,nickname,email,password});}static async logout(){if(!_joiner__WEBPACK_IMPORTED_MODULE_2__["U"].isOffline())await _data_api__WEBPACK_IMPORTED_MODULE_0__["default"].delete("".concat(_data_api__WEBPACK_IMPORTED_MODULE_0__["default"].persistance,"/auth/logout"));_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].reset();_joiner__WEBPACK_IMPORTED_MODULE_2__["U"].resetState();}static offline(){_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].write('offline','true');const user=_joiner__WEBPACK_IMPORTED_MODULE_2__["DUser"].new('Offline','User','Unknown','Unknown','Unknown',false,'Unknown','Unknown',"Pointer_OfflineUser");//`Pointer${Date.now()}_OfflineUser`);
_data_storage__WEBPACK_IMPORTED_MODULE_1__["default"].write('user',user);}}

/***/ }),
Expand Down Expand Up @@ -399119,7 +399119,7 @@ class Api{static headers(){let token=_storage__WEBPACK_IMPORTED_MODULE_1__["defa

"use strict";
__webpack_require__.r(__webpack_exports__);
class Storage{static read(key){try{return JSON.parse(localStorage.getItem(key)||'');}catch(e){return null;}}static write(key,obj){localStorage.setItem(key,JSON.stringify(obj||''));}/*static reset(): void { localStorage.clear(); } NO! never fully reset the state or offline mode breaks completely with lost data. */}/* harmony default export */ __webpack_exports__["default"] = (Storage);
class Storage{static read(key){try{return JSON.parse(localStorage.getItem(key)||'');}catch(e){return null;}}static write(key,obj){localStorage.setItem(key,JSON.stringify(obj||''));}static reset(){localStorage.clear();}/* NO! never fully reset the state or offline mode breaks completely with lost data. */}/* harmony default export */ __webpack_exports__["default"] = (Storage);

/***/ }),

Expand Down Expand Up @@ -405572,4 +405572,4 @@ c.thiss.viewpoint=c.thiss.id;return c.DViewElement(name,'').DViewPoint().end(cal
/***/ })

/******/ });
//# sourceMappingURL=main.8056056f.js.map
//# sourceMappingURL=main.a359f6ab.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/api/persistance/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class AuthApi {
}
static async logout(): Promise<void> {
if(!U.isOffline()) await Api.delete(`${Api.persistance}/auth/logout`);

Storage.reset();

U.resetState();
}

Expand Down
2 changes: 1 addition & 1 deletion src/data/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Storage {
localStorage.setItem(key, JSON.stringify(obj || ''));
}

/*static reset(): void { localStorage.clear(); } NO! never fully reset the state or offline mode breaks completely with lost data. */
static reset(): void { localStorage.clear(); } /* NO! never fully reset the state or offline mode breaks completely with lost data. */
}

export default Storage;
Expand Down

0 comments on commit 4344f54

Please sign in to comment.