There appears to be an error in retrieving the value for the user's opt-out option from the store at the

I am currently utilizing electron-store version 5.2.0 in my Angular project and I am seeking assistance in locating the path or understanding how to retrieve the path when using store.get("userOptionOptOut").

Within app.component.ts:

const Store = (window as any).require('electron-store');
const store = new Store();

const { ipcRenderer } = window.require('electron');

In the constructor of app.component.ts:

If(store.get('userOptionOptOut') !== undefined) {
      this.userOptionOptOut = store.get('userOptionOptOut');
      this.settingService.patchSettingBySettingPath(this.dataCollectionSetting, this.userOptionOptOut);
}

I have a config.json file located at C:\Users\XXXX\AppData\Roaming\XXXX\XXXX\AppConfig\AppName which stores the settings:

{
    "userOptionOptOut":  "On"
}

However, I encountered an error (View image below) while trying to verify the path, so I included the following code:

const { app } = window.require('electron');

  console.log(app.getAppPath());
  console.log(app.getPath("userData"));
  console.log(app.getPath("appData"));

https://i.sstatic.net/za55T.png

Answer №1

After examining the path, I discovered an issue. The correct path that I am looking for is located here, so I will need to ensure that the path is properly set in main.ts

 if (process.platform === 'win32') {
  app.setPath ('userData', app.getPath('appData') + '\\XXXX\\XXXX\\AppConfig\\' + 
 app.getName());
 } else {
  app.setPath ('userData', require('os').homedir() + '/.XXXX/XXXX/AppConfig/' + 
app.getName());
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error message: "No such file or directory found for Angular ng"

Recently, I encountered an issue while attempting to host an Angular app on a server. When using the command ng serve, it returned an error stating "No such file or directory," despite the fact that the ng command is visible in the image below. https://i. ...

Ensure to verify within the ngOnInit function whether the checkbox has been selected

Hi everyone, I'm currently facing a situation where I have a list of checkboxes on one screen. When I select some checkboxes, they move to another screen and remain selected there. However, the issue is that when I try to use a button on the second sc ...

WebStorm is struggling to interpret the syntax of Angular 2

After setting up a new project in Angular CLI and using WebStorm, I've noticed that the IDE doesn't recognize Angular 2 syntax such as *ngFor and lacks autocomplete features for it. https://i.sstatic.net/wwxXQ.png Seeking assistance on enabling ...

Error message in Angular unit testing using TypeScript: TS2304 - Unable to locate the identifier 'module'

I'm currently facing an issue while writing my first Angular unit test in TypeScript. I keep receiving the error TS2304: Cannot find name 'module'. If anyone has any insights or suggestions on how to resolve this, I would greatly appreciate ...

Having trouble with showing dynamic data in column2 of my HTML layout, and the alignment doesn't look quite right in HTML

I'm working with this HTML file, attempting to create a two-column layout using HTML and CSS. I want one column to be labeled REQUEST and the other RESPONSE. When a value is entered in the text field in Column 1, it should display a response in Column ...

Angular CORS Issue - Troubles with Cross-Origin Requests and XMLHttpRequest

I'm trying to make a call to an API from my backend (node) and the Chrome console is showing this error: Access to XMLHttpRequest at 'http://127.0.0.1:4201/api//listar_clientes_filtrado_admin' from origin 'http://localhost:4200' ...

"Troubleshooting: The Angular Check-All feature is unexpectedly selecting disabled checkboxes within the ngx data

Within ngx-datatable, I have implemented a functionality where some checkboxes are disabled based on certain conditions. However, when I try to select all checkboxes, even the disabled ones get selected. How can this issue be resolved so that disabled chec ...

Tips for simulating Firebase authentication providers like FacebookAuthProvider?

My goal is to create a mock for the firebase.auth object in react-native-firebase, specifically targeting the signInWithCredential method. This mock will allow me to test my code effectively. The code I am testing looks like this: public async FacebookSi ...

Unable to locate the JSON file for loading in ThreeJS

I am currently attempting to load an external model from Blender onto an Angular app using Three.js. I have been following a tutorial for guidance, found here. However, I have encountered an issue when trying to load the external file: loader.load('. ...

Steps for disabling the websocket when the component is unmounted

Below is a snippet of my code. I am attempting to close the websocket connection when the component unmounts, but I'm unsure of the proper approach. Within the same component, I am using useEffect along with useRef to ensure that only one instance of ...

How can the component prefix be replaced or updated in Angular 8/9?

Is there a way to efficiently replace or modify the outdated component prefix all at once? OR How can I create a dynamic prefix system that automatically updates all component prefixes whenever changes are needed? ...

The Vue store array declaration triggers a TS error stating that it is not assignable to a parameter of type never

I'm puzzled as to why this error keeps showing up: Argument of type '{ id: string; }' is not assignable to parameter of type 'never'. ... appearing at const index = state.sections.findIndex((section) => section.id === id); T ...

Angular Interruption/Stoppage Upon Unhandled Exception

Is it possible to break or pause on uncaught exceptions in my application within Chrome when using Angular? It seems that zone.js catches these exceptions and logs them internally, preventing the 'pause on exceptions' feature from working as the ...

What is the importance of maintaining immutability for objects in Redux?

What is the importance of immutability in Redux? While I understand that frameworks like Angular2 use onPush to leverage immutability for quicker rendering of views, I'm interested in learning about other reasons why Redux emphasizes immutability desp ...

Dynamic side menu change in Ionic 3 allows for flexibility and customization in the app's

Is there a way to automatically change the direction of the side menu when switching between languages (rtl and ltr)? I attempted to implement this functionality in the app.html page using the following code: <ion-menu [side]="isRtl?'right':& ...

Exploring the possibilities of utilizing Angular 2 in conjunction with YII2

Why am I asking this question? I want to incorporate Angular2 routes on my Frontend and YII2 views on the Backend. I'm considering using AJAX page loading with Angular2 for YII2 pages... hmm... That's an interesting idea. But, is it the right a ...

The Angular Firebase query is being run repeatedly

I'm currently facing an issue in my project where Firebase queries are being executed multiple times. This problem wasn't present during development and no changes have been made to the Firebase dependencies. Below is a snippet of code that used ...

Angular 7: Separate Views for Search Bar and Results

Two components have been developed: search-bar.component.ts: displayed in all views search.component.ts: responsible for displaying the results (response from a REST API) The functionality is as follows: whenever I need to perform a global search (produ ...

Encountered an issue when utilizing the useRef hook in Next.js version 13

I am currently exploring nextjs13 and typescript. I encountered an issue when attempting to use the useRef hook. Below is the code snippet in question: import { useEffect, useRef } from "react" export const useDraw = () => { const canvas ...

Extracting Table(Array) Index into a Component in Angular

For my data on the HTML page, I created a 2-dimensional array. <tbody> <tr *ngFor="let i of myarray2"> <td *ngFor="let j of i"> {{j}} </td> </tr> </tbody> This is how it appears: https://i.sstatic.ne ...