mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-29 16:16:02 +00:00
Implement bookmarking
This commit is contained in:
@@ -2,12 +2,12 @@ import { DefinedTool } from '@tools/defineTool';
|
||||
|
||||
const bookmarkedToolsKey = 'bookmarkedTools';
|
||||
|
||||
export function getBookmarkedTools(): string[] {
|
||||
export function getBookmarkedToolPaths(): string[] {
|
||||
return localStorage.getItem(bookmarkedToolsKey)?.split(',') ?? [];
|
||||
}
|
||||
|
||||
export function isBookmarked(tool: DefinedTool): boolean {
|
||||
return getBookmarkedTools().some((path) => path === tool.path);
|
||||
return getBookmarkedToolPaths().some((path) => path === tool.path);
|
||||
}
|
||||
|
||||
export function toggleBookmarked(tool: DefinedTool) {
|
||||
@@ -21,7 +21,7 @@ export function toggleBookmarked(tool: DefinedTool) {
|
||||
function bookmark(tool: DefinedTool) {
|
||||
localStorage.setItem(
|
||||
bookmarkedToolsKey,
|
||||
tool.path + localStorage.getItem(bookmarkedToolsKey)
|
||||
tool.path + ',' + (localStorage.getItem(bookmarkedToolsKey) ?? '')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user