Refactor API URLs to use GlobalConstants and update CORS configurations for production
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import {GlobalConstants} from '../global-constants';
|
||||
|
||||
const AUTH_API = 'http://localhost:8080/api/auth/';
|
||||
const AUTH_API = GlobalConstants.API_URL + '/auth/';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
||||
@@ -15,6 +16,7 @@ export class AuthService {
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
login(username: string, password: string): Observable<any> {
|
||||
console.log(AUTH_API + 'signin');
|
||||
return this.http.post(AUTH_API + 'signin', {
|
||||
username,
|
||||
password
|
||||
|
||||
@@ -2,8 +2,9 @@ import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Role } from '../models/role';
|
||||
import {GlobalConstants} from '../global-constants';
|
||||
|
||||
const API_URL = 'http://localhost:8080/api/roles';
|
||||
const API_URL = `${GlobalConstants.API_URL}/roles`;
|
||||
|
||||
|
||||
@Injectable({
|
||||
|
||||
@@ -4,13 +4,14 @@ import {Observable} from 'rxjs';
|
||||
import {Tutorial} from '../models/tutorial.model';
|
||||
import {Bean} from '../models/Bean';
|
||||
import {NameValueItem} from '../models/name-value-item';
|
||||
import {GlobalConstants} from '../global-constants';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SystemService {
|
||||
|
||||
baseUrl : string = 'http://localhost:8080/api/system';
|
||||
baseUrl : string = `${GlobalConstants.API_URL}/system`;
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
getDataSourceProperties(): Observable<NameValueItem[]>{
|
||||
|
||||
@@ -2,9 +2,9 @@ import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Tutorial } from '../models/tutorial.model';
|
||||
import {text} from 'node:stream/consumers';
|
||||
import {GlobalConstants} from '../global-constants';
|
||||
|
||||
const baseUrl = 'http://localhost:8080/api/public/tutorials';
|
||||
const baseUrl = `${GlobalConstants.API_URL}/public/tutorials`;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
||||
@@ -2,9 +2,9 @@ import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import {User} from "../models/user.model";
|
||||
import {Tutorial} from "../models/tutorial.model";
|
||||
import {GlobalConstants} from '../global-constants';
|
||||
|
||||
const API_URL = 'http://localhost:8080/api/users';
|
||||
const API_URL = `${GlobalConstants.API_URL}/users`;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
||||
@@ -4,6 +4,7 @@ import {Tutorial} from '../models/tutorial.model';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Image} from '../models/image';
|
||||
import {SpinnerService} from './spinner.service';
|
||||
import {GlobalConstants} from '../global-constants';
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +14,7 @@ import {SpinnerService} from './spinner.service';
|
||||
|
||||
|
||||
export class ZhipuaiImageService {
|
||||
baseUrl : string = 'http://localhost:8080/api/zhipuai';
|
||||
baseUrl : string = `${GlobalConstants.API_URL}/public/zhipuai`;
|
||||
|
||||
constructor(private http: HttpClient,public spinnerService: SpinnerService) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user