summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/clear-cache.ts
blob: b20109ec72bf96fb5a1fee52101c99020ad5b8ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { unisonReload } from '@/scripts/unison-reload.js';
import * as os from '@/os.js';
import { miLocalStorage } from '@/local-storage.js';
import { fetchCustomEmojis } from '@/custom-emojis.js';
import { fetchInstance } from '@/instance.js';

export async function clearCache() {
	os.waiting();
	miLocalStorage.removeItem('instance');
	miLocalStorage.removeItem('instanceCachedAt');
	miLocalStorage.removeItem('locale');
	miLocalStorage.removeItem('localeVersion');
	miLocalStorage.removeItem('theme');
	miLocalStorage.removeItem('emojis');
	miLocalStorage.removeItem('lastEmojisFetchedAt');
	await fetchInstance(true);
	await fetchCustomEmojis(true);
	unisonReload();
}