Tailwind config and basic services

This commit is contained in:
Aslan 2025-12-31 17:15:14 +01:00
parent f1e90c4dd2
commit be6467cd2c
41 changed files with 581 additions and 102 deletions

View 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 };

View file

@ -0,0 +1,2 @@
export * from "./community";
export * from "./types";

View file

@ -0,0 +1,11 @@
interface IFetchCommunityRequest {
id: string;
}
interface IFetchCommunityResponse {
id: string;
name: string;
description: string;
}
export { type IFetchCommunityRequest, type IFetchCommunityResponse };

View file

@ -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 };

View file

@ -1,5 +0,0 @@
interface IGameTimeResponse {
time: number;
}
export { type IGameTimeResponse };

2
src/api/user/index.ts Normal file
View file

@ -0,0 +1,2 @@
export * from "./user";
export * from "./types";

37
src/api/user/types.ts Normal file
View 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
View 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 };