Skip to content

Commit

Permalink
Merge pull request #56 from AplinkosMinisterija/web_repozitorijose_su…
Browse files Browse the repository at this point in the history
…keisti_adresus

sukeisti adresai
  • Loading branch information
DovMa authored Mar 27, 2024
2 parents 0473b42 + 52b44b1 commit e5f5bb2
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
7 changes: 6 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
VITE_PROXY_URL=https://dev.internalapi.biip.lt/zuvinimasnew/api
VITE_PROXY_URL=https://zuvinimas.biip.lt/api
VITE_MAPS_HOST=https://maps.biip.lt
VITE_SENTRY_DSN=
VITE_ENVIRONMENT=


2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
run: yarn run build --mode development
env:
NODE_ENV: development
VITE_MAPS_HOST: https://dev.maps.biip.lt
VITE_ZUVINIMAS_API_BASE_URL: https://dev.zuvinimas.biip.lt/api

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
build-args: |
NODE_ENV=development
VITE_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
VITE_MAPS_HOST=https://dev.maps.biip.lt
VITE_MAPS_HOST=https://dev-maps.biip.lt
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
build-args: |
NODE_ENV=production
VITE_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
VITE_MAPS_HOST=https://staging.maps.biip.lt
VITE_MAPS_HOST=https://staging-maps.biip.lt
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ ARG VITE_ENVIRONMENT=${ENVIRONMENT}
ARG VITE_VERSION=${VERSION}

# Set env variables
ARG VITE_MAPS_HOST=
ARG VITE_SENTRY_DSN=
ARG NODE_ENV=production
ARG VITE_SENTRY_DSN=
ARG VITE_MAPS_HOST=


# Build and cleanup
RUN yarn build
Expand Down
9 changes: 3 additions & 6 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Cookies from 'universal-cookie';
import { Resources } from './constants';

const cookies = new Cookies();
const env = import.meta.env;

interface GetAll {
resource?: string;
Expand Down Expand Up @@ -79,11 +78,9 @@ interface Create {

class Api {
private AuthApiAxios: AxiosInstance;
private readonly apiBaseUrl: string;
private readonly proxy: string = '/api';

constructor() {
this.apiBaseUrl = env.VITE_ZUVINIMAS_API_BASE_URL ?? '/api';

this.AuthApiAxios = Axios.create();
this.AuthApiAxios.interceptors.request.use(
(config) => {
Expand All @@ -93,7 +90,7 @@ class Api {
config.headers!.Authorization = 'Bearer ' + token;
if (isFinite(parseInt(profileId))) config.headers!['X-Profile'] = profileId;
}
config.url = this.apiBaseUrl + config.url;
config.url = this.proxy + config.url;
return config;
},
(error) => {
Expand Down Expand Up @@ -418,7 +415,7 @@ class Api {
const profileId = cookies.get('profileId');

const response = await fetch(
`${this.apiBaseUrl}/${Resources.EXCEL}?filter=${JSON.stringify(filter)}`,
`${this.proxy}/${Resources.EXCEL}?filter=${JSON.stringify(filter)}`,
{
headers: {
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/texts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const toasts = {
profileUpdated: 'Profilis atnaujintas',
};

const mapsHost = import.meta.env.VITE_MAPS_HOST || 'https://dev.maps.biip.lt';
const mapsHost = import.meta.env.VITE_MAPS_HOST;
export const Url = {
DRAW: `${mapsHost}/zuvinimas/draw`,
FISH_STOCKING: `${mapsHost}/zuvinimas`,
Expand Down
1 change: 0 additions & 1 deletion src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

interface ImportMetaEnv {
readonly NODE_ENV: 'development' | 'production';
readonly VITE_ZUVINIMAS_API_BASE_URL?: string;
readonly VITE_SENTRY_DSN?: string;
readonly VITE_ENVIRONMENT?: string;
readonly VITE_MAPS_HOST?: string;
Expand Down

0 comments on commit e5f5bb2

Please sign in to comment.