forked from finos/git-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ts
More file actions
36 lines (31 loc) · 1.36 KB
/
config.ts
File metadata and controls
36 lines (31 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import axios from 'axios';
import { QuestionFormData } from '../types';
import { UIRouteAuth } from '../../config/generated/config';
import { getApiV1BaseUrl } from './apiConfig';
const setAttestationConfigData = async (setData: (data: QuestionFormData[]) => void) => {
const apiV1Base = await getApiV1BaseUrl();
const url = new URL(`${apiV1Base}/config/attestation`);
const response = await axios(url.toString());
setData(response.data.questions);
};
const setURLShortenerData = async (setData: (data: string) => void) => {
const apiV1Base = await getApiV1BaseUrl();
const url = new URL(`${apiV1Base}/config/urlShortener`);
const response = await axios(url.toString());
setData(response.data);
};
const setEmailContactData = async (setData: (data: string) => void) => {
const apiV1Base = await getApiV1BaseUrl();
const url = new URL(`${apiV1Base}/config/contactEmail`);
const response = await axios(url.toString());
setData(response.data);
};
const setUIRouteAuthData = async (setData: (data: UIRouteAuth) => void) => {
const apiV1Base = await getApiV1BaseUrl();
const urlString = `${apiV1Base}/config/uiRouteAuth`;
console.log(`URL: ${urlString}`);
const url = new URL(urlString);
const response = await axios(url.toString());
setData(response.data);
};
export { setAttestationConfigData, setURLShortenerData, setEmailContactData, setUIRouteAuthData };