feat: Add new emoji assets and an UpdateBanner component.
Some checks failed
Build and Release / build-and-release (push) Failing after 3m28s
Some checks failed
Build and Release / build-and-release (push) Failing after 3m28s
This commit is contained in:
34
packages/platform-web/src/session.js
Normal file
34
packages/platform-web/src/session.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Web platform session persistence using localStorage.
|
||||
* Returns Promises to match the Electron IPC-based API contract.
|
||||
*/
|
||||
const SESSION_KEY = 'discord-clone-session';
|
||||
|
||||
export default {
|
||||
save(data) {
|
||||
try {
|
||||
localStorage.setItem(SESSION_KEY, JSON.stringify(data));
|
||||
return Promise.resolve(true);
|
||||
} catch {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
},
|
||||
|
||||
load() {
|
||||
try {
|
||||
const raw = localStorage.getItem(SESSION_KEY);
|
||||
return Promise.resolve(raw ? JSON.parse(raw) : null);
|
||||
} catch {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
},
|
||||
|
||||
clear() {
|
||||
try {
|
||||
localStorage.removeItem(SESSION_KEY);
|
||||
return Promise.resolve(true);
|
||||
} catch {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user