clean up など
This commit is contained in:
@@ -4,40 +4,6 @@
|
||||
|
||||
import '@/style.scss';
|
||||
|
||||
// TODO: そのうち消す
|
||||
if (localStorage.getItem('vuex') != null) {
|
||||
const vuex = JSON.parse(localStorage.getItem('vuex'));
|
||||
|
||||
localStorage.setItem('account', JSON.stringify({
|
||||
...vuex.i,
|
||||
token: localStorage.getItem('i')
|
||||
}));
|
||||
localStorage.setItem('accounts', JSON.stringify(vuex.device.accounts));
|
||||
localStorage.setItem('miux:themes', JSON.stringify(vuex.device.themes));
|
||||
|
||||
if (vuex.device.userData) {
|
||||
for (const [k, v] of Object.entries(vuex.device.userData)) {
|
||||
localStorage.setItem('pizzax::base::' + k, JSON.stringify({
|
||||
widgets: v.widgets
|
||||
}));
|
||||
|
||||
if (v.deck) {
|
||||
localStorage.setItem('pizzax::deck::' + k, JSON.stringify({
|
||||
columns: v.deck.columns,
|
||||
layout: v.deck.layout,
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
localStorage.setItem('vuex-old', JSON.stringify(vuex));
|
||||
localStorage.removeItem('vuex');
|
||||
localStorage.removeItem('i');
|
||||
localStorage.removeItem('locale');
|
||||
|
||||
location.reload();
|
||||
}
|
||||
|
||||
import * as Sentry from '@sentry/browser';
|
||||
import { Integrations } from '@sentry/tracing';
|
||||
import { createApp, watch } from 'vue';
|
||||
|
@@ -212,7 +212,6 @@ type Plugin = {
|
||||
*/
|
||||
export class ColdDeviceStorage {
|
||||
public static default = {
|
||||
themes: [] as Theme[], // TODO: そのうち消す
|
||||
// TODO: テーマをアカウントに保存するようになったのにもかかわらず、以下のどのテーマを使うかという情報だけがブラウザ保存になっていて、アカウント切り替えたりログアウトしたときに不具合が発生するのでなんとかする
|
||||
// テーマIDを保存するのではなく、テーマ自体を保存するようにすれば解決するかも
|
||||
darkTheme: '8050783a-7f63-445a-b270-36d0f6ba1677',
|
||||
|
@@ -33,30 +33,3 @@ export async function removeTheme(theme: Theme): Promise<void> {
|
||||
await api('i/registry/set', { scope: ['client'], key: 'themes', value: themes });
|
||||
localStorage.setItem(lsCacheKey, JSON.stringify(themes));
|
||||
}
|
||||
|
||||
// TODO: そのうち消す
|
||||
if (ColdDeviceStorage.get('themes').length > 0) {
|
||||
const lsThemes = ColdDeviceStorage.get('themes');
|
||||
let registryThemes;
|
||||
try {
|
||||
registryThemes = await api('i/registry/get', { scope: ['client'], key: 'themes' });
|
||||
} catch (e) {
|
||||
if (e.code === 'NO_SUCH_KEY') {
|
||||
registryThemes = [];
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
const themes = [] as Theme[];
|
||||
for (const theme of lsThemes) {
|
||||
if (themes.some(x => x.id === theme.id)) continue;
|
||||
themes.push(theme);
|
||||
}
|
||||
for (const theme of registryThemes) {
|
||||
if (themes.some(x => x.id === theme.id)) continue;
|
||||
themes.push(theme);
|
||||
}
|
||||
await api('i/registry/set', { scope: ['client'], key: 'themes', value: themes });
|
||||
localStorage.setItem(lsCacheKey, JSON.stringify(themes));
|
||||
ColdDeviceStorage.set('themes', []);
|
||||
}
|
||||
|
Reference in New Issue
Block a user