fix: reload script active tab and api url

This commit is contained in:
Michal Szczepanski 2023-03-12 18:03:25 +01:00
parent 32a6ba6a1d
commit d37b143c3a
3 changed files with 9 additions and 7 deletions

@ -1,6 +1,6 @@
VERSION=1
API_URL='http://localhost:3000'
SHORT_URL='http://localhost:8001'
WEB_URL='http://localhost:5173'
API_URL=http://localhost:5173
SHORT_URL=http://localhost:5173
WEB_URL=http://localhost:5173
IS_PRODUCTION=false
OBJ_LIST_LIMIT=20

@ -1,6 +1,6 @@
/*
* This file is part of the pinmenote-extension distribution (https://github.com/pinmenote/pinmenote-extension).
* Copyright (c) 2022 Michal Szczepanski.
* Copyright (c) 2023 Michal Szczepanski.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,9 +25,11 @@ import jwtDecode from 'jwt-decode';
export class ApiLoginCommand implements ICommand<Promise<TokenUserDto>> {
constructor(private data: LoginDto) {}
async execute(): Promise<TokenUserDto> {
const resp = await FetchService.post<AccessTokenDto>(`${environmentConfig.url.api}/api/v1/login`, this.data);
fnConsoleLog('ApiLoginCommand->execute', environmentConfig.url.api);
fnConsoleLog('WorkerApiManager->login', resp);
const resp = await FetchService.post<AccessTokenDto>(`${environmentConfig.url.api}/api/v1/auth/login`, this.data);
fnConsoleLog('ApiLoginCommand->execute', resp);
await new TokenStorageSetCommand(resp).execute();

@ -21,7 +21,7 @@ export class ScriptService {
static reloadScripts = async (): Promise<void> => {
try {
const activeTab = await BrowserApi.activeTab();
if (!activeTab.url) return;
if (!activeTab?.url) return;
if (activeTab.url.startsWith('chrome')) return;
if (!activeTab.id) return;