Tailwind config and basic services
This commit is contained in:
parent
f1e90c4dd2
commit
be6467cd2c
41 changed files with 581 additions and 102 deletions
10
src/api/community/community.ts
Normal file
10
src/api/community/community.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { callApi, HTTP } from "../tools";
|
||||
import { IFetchCommunityRequest, IFetchCommunityResponse } from "./types";
|
||||
|
||||
const fetchCommunityApi = async (
|
||||
request: IFetchCommunityRequest,
|
||||
): Promise<IFetchCommunityResponse> => {
|
||||
return await callApi(HTTP.GET, `community/${request.id}`);
|
||||
};
|
||||
|
||||
export { fetchCommunityApi };
|
||||
2
src/api/community/index.ts
Normal file
2
src/api/community/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./community";
|
||||
export * from "./types";
|
||||
11
src/api/community/types.ts
Normal file
11
src/api/community/types.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
interface IFetchCommunityRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface IFetchCommunityResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export { type IFetchCommunityRequest, type IFetchCommunityResponse };
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
import { callApi, HTTP } from "../tools";
|
||||
import { IGameTimeResponse } from "./types";
|
||||
|
||||
async function fetchTimeApi(): Promise<IGameTimeResponse> {
|
||||
const data = await callApi(HTTP.GET, "game/time");
|
||||
|
||||
return {
|
||||
time: data,
|
||||
};
|
||||
}
|
||||
|
||||
export { fetchTimeApi };
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
interface IGameTimeResponse {
|
||||
time: number;
|
||||
}
|
||||
|
||||
export { type IGameTimeResponse };
|
||||
2
src/api/user/index.ts
Normal file
2
src/api/user/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./user";
|
||||
export * from "./types";
|
||||
37
src/api/user/types.ts
Normal file
37
src/api/user/types.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
interface IFetchLoggedUserResponse {
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface IFetchUserRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface IFetchUserResponse {
|
||||
id: string;
|
||||
username: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface IFetchUserCommunitiesRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface IFetchUserCommunitiesResponse {
|
||||
id: string;
|
||||
communities: IFetchUserCommunity[];
|
||||
}
|
||||
|
||||
interface IFetchUserCommunity {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export {
|
||||
type IFetchLoggedUserResponse,
|
||||
type IFetchUserRequest,
|
||||
type IFetchUserResponse,
|
||||
type IFetchUserCommunitiesRequest,
|
||||
type IFetchUserCommunitiesResponse,
|
||||
type IFetchUserCommunity,
|
||||
};
|
||||
26
src/api/user/user.ts
Normal file
26
src/api/user/user.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { callApi, HTTP } from "../tools";
|
||||
import {
|
||||
IFetchLoggedUserResponse,
|
||||
IFetchUserRequest,
|
||||
IFetchUserResponse,
|
||||
IFetchUserCommunitiesRequest,
|
||||
IFetchUserCommunitiesResponse,
|
||||
} from "./types";
|
||||
|
||||
const fetchLoggedUserApi = async (): Promise<IFetchLoggedUserResponse> => {
|
||||
return await callApi(HTTP.GET, `user/logged`);
|
||||
};
|
||||
|
||||
const fetchUserApi = async (
|
||||
request: IFetchUserRequest,
|
||||
): Promise<IFetchUserResponse> => {
|
||||
return await callApi(HTTP.GET, `user/${request.id}`);
|
||||
};
|
||||
|
||||
const fetchUserCommunitiesApi = async (
|
||||
request: IFetchUserCommunitiesRequest,
|
||||
): Promise<IFetchUserCommunitiesResponse> => {
|
||||
return await callApi(HTTP.GET, `user/${request.id}/communities`);
|
||||
};
|
||||
|
||||
export { fetchLoggedUserApi, fetchUserApi, fetchUserCommunitiesApi };
|
||||
Loading…
Add table
Add a link
Reference in a new issue