ntfy/web/src/app/Session.js

23 lines
443 B
JavaScript
Raw Normal View History

2022-12-02 20:37:48 +00:00
class Session {
store(username, token) {
localStorage.setItem("user", username);
localStorage.setItem("token", token);
}
reset() {
localStorage.removeItem("user");
localStorage.removeItem("token");
}
username() {
return localStorage.getItem("user");
}
token() {
return localStorage.getItem("token");
}
}
const session = new Session();
export default session;