blob: e292d53ebe814f04fe048b169fe99307b8b4c578 (
plain) (
blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
export const SENPY_CLUB_API_BASE_URl = "https://api.senpy.club";
export const SENPY_CLUB_API_CURRENT_VERSION = 2;
export const SENPY_CLUB_API_URl = `${SENPY_CLUB_API_BASE_URl}/v${SENPY_CLUB_API_CURRENT_VERSION}`;
export interface Random {
readonly language: string;
readonly image: string;
}
export const languages = (): string[] => {
let response;
fetch(`${SENPY_CLUB_API_URl}/languages`)
.then((api) => api.json())
.then((api) => {
response = api;
});
return response;
};
export const language = (language: string): string[] => {
let response;
fetch(`${SENPY_CLUB_API_URl}/language/${language}`)
.then((api) => api.json())
.then((api) => {
response = api;
});
return response;
};
export const random = (): Random => {
let response;
fetch(`${SENPY_CLUB_API_URl}/random`)
.then((api) => api.json())
.then((api) => {
response = api;
});
return response;
};
export const status = (): boolean => {
let response;
fetch(`${SENPY_CLUB_API_URl}`)
.then(() => {
response = true;
})
.catch(() => {
response = false;
});
return response;
};
|