MCPcopy Index your code
hub / github.com/spicetify/cli / CacheButton

Function CacheButton

CustomApps/lyrics-plus/Settings.js:40–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38};
39
40const CacheButton = () => {
41 let lyrics = {};
42
43 try {
44 const localLyrics = JSON.parse(localStorage.getItem("lyrics-plus:local-lyrics"));
45 if (!localLyrics || typeof localLyrics !== "object") {
46 throw "";
47 }
48 lyrics = localLyrics;
49 } catch {
50 lyrics = {};
51 }
52
53 const [count, setCount] = useState(Object.keys(lyrics).length);
54 const text = count ? "Clear all cached lyrics" : "No cached lyrics";
55
56 return react.createElement(
57 "button",
58 {
59 className: "btn",
60 onClick: () => {
61 localStorage.removeItem("lyrics-plus:local-lyrics");
62 setCount(0);
63 },
64 disabled: !count,
65 },
66 text
67 );
68};
69
70const RefreshTokenButton = ({ setTokenCallback }) => {
71 const [buttonText, setButtonText] = useState("Refresh token");

Callers

nothing calls this directly

Calls 1

removeItemMethod · 0.80

Tested by

no test coverage detected