Skip to content

Commit

Permalink
Update profile storage for browser
Browse files Browse the repository at this point in the history
  • Loading branch information
undyingwraith committed Dec 11, 2024
1 parent e0b4dd6 commit 5871a5c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/webui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,19 @@ export function App() {
<IpmcLauncher
configService={{
getProfile(name) {
const value = window.localStorage.getItem('profile_' + name);
return value ? JSON.parse(value) : undefined;
const value = window.localStorage.getItem('profiles');
return value ? JSON.parse(value)[name] : undefined;
},
getProfiles() {
const value = window.localStorage.getItem('profiles');
return value ? JSON.parse(value) : [];
return value ? Object.keys(JSON.parse(value)) : [];
},
setProfile(name, profile) {
window.localStorage.setItem('profile_' + name, JSON.stringify(profile));
const value = window.localStorage.getItem('profiles');
const profiles: string[] = value ? JSON.parse(value) : [];
if (!profiles.some(p => p == name)) {
window.localStorage.setItem('profiles', JSON.stringify([...profiles, name]));
}
const profilesString = window.localStorage.getItem('profiles');
const profiles = profilesString ? JSON.parse(profilesString) : {};
profiles[name] = profile;

window.localStorage.setItem('profiles', JSON.stringify(profiles));
},
}}
nodeService={{
Expand Down

0 comments on commit 5871a5c

Please sign in to comment.