Skip to content

Commit

Permalink
fix: joint api error
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Nov 1, 2022
1 parent 0746c23 commit 91dd7d9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ElectronService } from 'eo/workbench/browser/src/app/core/services';
import { DownloadClienteComponent } from 'eo/workbench/browser/src/app/core/services/web/download-client.component';
import { PROTOCOL } from 'eo/workbench/browser/src/app/shared/constants/protocol';
import { ModalService } from 'eo/workbench/browser/src/app/shared/services/modal.service';
import { SettingService } from 'eo/workbench/browser/src/app/core/services/settings/settings.service';

@Injectable({
providedIn: 'root',
Expand Down Expand Up @@ -33,7 +34,12 @@ export class WebService {
link: '',
},
];
constructor(private modalService: ModalService, private electronService: ElectronService) {
constructor(
private modalService: ModalService,
private settingService: SettingService,
private electronService: ElectronService
) {
this.settingService.putSettings({'eoapi-common.remoteServer.url':window.location.origin});
this.getClientResource();
}
private findLinkInSingleAssets(assets, item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { RemoteService } from 'eo/workbench/browser/src/app/shared/services/stor
import { distinct } from 'rxjs/operators';
import { interval } from 'rxjs';
import { copy } from 'eo/workbench/browser/src/app/utils/index.utils';
import { EoMessageService } from 'eo/workbench/browser/src/app/eoui/message/eo-message.service';
import { LanguageService } from 'eo/workbench/browser/src/app/core/services/language/language.service';
@Component({
selector: 'eo-navbar',
Expand Down Expand Up @@ -41,7 +40,6 @@ export class NavbarComponent implements OnInit {
public dataSourceService: DataSourceService,
public status: StatusService,
private http: RemoteService,
private eoMessage: EoMessageService,
private lang: LanguageService
) {
this.issueEnvironment = this.getEnviroment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class DataSourceService {
private http: RemoteService,
private web: WebService
) {
console.log('init');
this.pingCloudServerUrl();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { WorkspaceService } from 'eo/workbench/browser/src/app/shared/services/w
import { ProjectService } from 'eo/workbench/browser/src/app/shared/services/project/project.service';
import { version2Number } from 'eo/workbench/browser/src/app/utils/index.utils';
import { MessageService } from 'eo/workbench/browser/src/app/shared/services/message';
import { WebService } from 'eo/workbench/browser/src/app/core/services';

const protocolReg = new RegExp('^(http|https)://');

Expand All @@ -40,10 +41,12 @@ export class BaseUrlInterceptor extends SettingService implements HttpIntercepto
constructor(
private workspaceService: WorkspaceService,
private projectService: ProjectService,
private messageService: MessageService
private messageService: MessageService,
private web: WebService
) {
super();
this.prefix = '/';
//* Web deploy from v1.9.1
this.prefix = this.web.isWeb?'/api/':'/';
}

intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
Expand Down Expand Up @@ -81,7 +84,6 @@ export class BaseUrlInterceptor extends SettingService implements HttpIntercepto
if (req.url.includes('/system/status')) {
const { data } = event.body;
this.prefix = version2Number(data) >= version2Number('v1.9.0') ? '/api' : '/';
console.log(data,this.prefix);
}
}),
catchError((err: any) => {
Expand Down

0 comments on commit 91dd7d9

Please sign in to comment.