File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const strip = ( s : string ) => s . replace ( / \/ + $ / , '' ) ;
2+ /**
3+ * The base URL for API requests.
4+ *
5+ * Uses the `VITE_API_URI` environment variable if set, otherwise defaults to the current origin.
6+ * @return {string } The base URL to use for API requests.
7+ */
8+ export const API_BASE = process . env . VITE_API_URI ? strip ( process . env . VITE_API_URI ) : '' ;
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ import { getUser } from '../../services/user';
1717import axios from 'axios' ;
1818import { getAxiosConfig } from '../../services/auth' ;
1919import { UserData } from '../../../types/models' ;
20- import { API_BASE } from '../../utils' ;
20+
21+ import { API_BASE } from '../../apiBase' ;
2122
2223const useStyles = makeStyles ( styles ) ;
2324
Original file line number Diff line number Diff line change 11import axios , { AxiosError , AxiosResponse } from 'axios' ;
22import { getAxiosConfig , processAuthError } from './auth' ;
33import { UserData } from '../../types/models' ;
4- import { API_BASE } from '../utils' ;
4+
5+ import { API_BASE } from '../apiBase' ;
56
67type SetStateCallback < T > = ( value : T | ( ( prevValue : T ) => T ) ) => void ;
78
Original file line number Diff line number Diff line change 11import axios from 'axios' ;
22import React from 'react' ;
33import {
4- SCMRepositoryMetadata ,
4+ CommitData ,
55 GitHubRepositoryMetadata ,
66 GitLabRepositoryMetadata ,
7- CommitData ,
7+ SCMRepositoryMetadata ,
88} from '../types/models' ;
99import moment from 'moment' ;
1010
11- const strip = ( s : string ) => s . replace ( / \/ + $ / , '' ) ;
12-
13- /**
14- * The base URL for API requests.
15- *
16- * Uses the `VITE_API_URI` environment variable if set, otherwise defaults to the current origin.
17- * @return {string } The base URL to use for API requests.
18- */
19- export const API_BASE = import . meta. env . VITE_API_URI ? strip ( import . meta. env . VITE_API_URI ) : '' ;
20-
2111/**
2212 * Retrieve a decoded cookie value from `document.cookie` with given `name`.
2313 * @param {string } name - The name of the cookie to retrieve
Original file line number Diff line number Diff line change @@ -13,8 +13,9 @@ import CardFooter from '../../components/Card/CardFooter';
1313import axios , { AxiosError } from 'axios' ;
1414import logo from '../../assets/img/git-proxy.png' ;
1515import { Badge , CircularProgress , Snackbar } from '@material-ui/core' ;
16- import { API_BASE , getCookie } from '../../utils' ;
16+ import { getCookie } from '../../utils' ;
1717import { useAuth } from '../../auth/AuthProvider' ;
18+ import { API_BASE } from '../../apiBase' ;
1819
1920interface LoginResponse {
2021 username : string ;
You can’t perform that action at this time.
0 commit comments