Tailwind config and basic services
This commit is contained in:
parent
f1e90c4dd2
commit
be6467cd2c
41 changed files with 581 additions and 102 deletions
16
src/services/community/community.ts
Normal file
16
src/services/community/community.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { fetchCommunityApi } from "../../api/community";
|
||||
import { CommunityActionTypes } from "../../store/community";
|
||||
import { dispatch } from "../../store/state";
|
||||
|
||||
const fetchCommunity = async (id: string) => {
|
||||
const data = await fetchCommunityApi({
|
||||
id: id,
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: CommunityActionTypes.FETCH_COMMUNITY_FINISH,
|
||||
payload: data,
|
||||
});
|
||||
};
|
||||
|
||||
export { fetchCommunity };
|
||||
1
src/services/community/index.ts
Normal file
1
src/services/community/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./community";
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import { fetchTimeApi } from "../../api/game/game";
|
||||
import { dispatch } from "../../store/state";
|
||||
|
||||
async function fetchTime() {
|
||||
const data = await fetchTimeApi();
|
||||
|
||||
dispatch({
|
||||
type: "FETCH_TIME_FINISH",
|
||||
payload: data.time,
|
||||
});
|
||||
}
|
||||
|
||||
export { fetchTime };
|
||||
1
src/services/user/index.ts
Normal file
1
src/services/user/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./user";
|
||||
48
src/services/user/user.ts
Normal file
48
src/services/user/user.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import {
|
||||
fetchLoggedUserApi,
|
||||
fetchUserApi,
|
||||
fetchUserCommunitiesApi,
|
||||
} from "../../api/user";
|
||||
import { UserActionTypes } from "../../store/user";
|
||||
import { CommunityActionTypes } from "../../store/community";
|
||||
import { dispatch } from "../../store/state";
|
||||
|
||||
const fetchLoggedUser = async () => {
|
||||
const data = await fetchLoggedUserApi();
|
||||
|
||||
dispatch({
|
||||
type: UserActionTypes.FETCH_LOGGED_USER_ID_FINISH,
|
||||
payload: data,
|
||||
});
|
||||
};
|
||||
|
||||
const fetchUser = async (id: string) => {
|
||||
const data = await fetchUserApi({
|
||||
id: id,
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: UserActionTypes.FETCH_USER_FINISH,
|
||||
payload: data,
|
||||
});
|
||||
};
|
||||
|
||||
const fetchUserCommunities = async (id: string) => {
|
||||
const data = await fetchUserCommunitiesApi({
|
||||
id: id,
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: UserActionTypes.FETCH_USER_COMMUNITIES_FINISH,
|
||||
payload: data,
|
||||
});
|
||||
|
||||
data.communities.forEach((community) => {
|
||||
dispatch({
|
||||
type: CommunityActionTypes.SET_COMMUNITY,
|
||||
payload: community,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export { fetchLoggedUser, fetchUser, fetchUserCommunities };
|
||||
Loading…
Add table
Add a link
Reference in a new issue