Skip to content

Commit

Permalink
fix(apis): update safeStorage variable to use window object instead o…
Browse files Browse the repository at this point in the history
…f global object to ensure compatibility with browser environment

fix(settings): update safeStorage variable to use window object instead of global object to ensure compatibility with browser environment
  • Loading branch information
anpigon committed Oct 18, 2023
1 parent 1fb2d5c commit d669ad5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/apis/google_books_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { apiGet, BaseBooksApiImpl } from '@apis/base_api';
import { Book } from '@models/book.model';
import { GoogleBooksResponse, VolumeInfo } from './models/google_books_response';

const safeStorage = global.electron?.remote.safeStorage;
const safeStorage = (window as any).electron?.remote.safeStorage;

export class GoogleBooksApi implements BaseBooksApiImpl {
constructor(private readonly localePreference: string, private readonly apiKey?: string) {}
Expand Down
2 changes: 1 addition & 1 deletion src/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SettingServiceProviderModal } from '@views/setting_service_provider_mod

const docUrl = 'https://github.com/anpigon/obsidian-book-search-plugin';

const safeStorage = global.electron?.remote.safeStorage;
const safeStorage = (window as any).electron?.remote.safeStorage;

export enum DefaultFrontmatterKeyType {
snakeCase = 'Snake Case',
Expand Down

0 comments on commit d669ad5

Please sign in to comment.