diff --git a/frontend-next-migration/src/entities/Clan/types/clan.d.ts b/frontend-next-migration/src/entities/Clan/types/clan.d.ts index ff9992121..858ea44c2 100644 --- a/frontend-next-migration/src/entities/Clan/types/clan.d.ts +++ b/frontend-next-migration/src/entities/Clan/types/clan.d.ts @@ -16,6 +16,21 @@ export type IClan = { phrase: string; labels: Array[]; positionLeaderboard?: number; + + roles: IClanRole[]; + goal: string; + clanLogo: string; + battlePoints: number; + language: string; + points: number; + ageRange: string; +}; + +export type IClanRole = { + _id: string; + name: string; + clanRoleType: string; + rights?: Record; }; export type IClanPosition = { @@ -37,11 +52,12 @@ export type ICreateClanResponse = { export type IJoin = { clan_id: string; player_id: string; - join_message: string; }; export type IClanCreateDto = Pick; export type IClanUpdateDto = Pick; -export type IJoinDto = Pick; +export type IJoinDto = Pick; + +export type IClanRoleDto = Pick; diff --git a/frontend-next-migration/src/features/JoinClan/model/useJoinClan.test.ts b/frontend-next-migration/src/features/JoinClan/model/useJoinClan.test.ts index 6df82f1aa..815aabbe6 100644 --- a/frontend-next-migration/src/features/JoinClan/model/useJoinClan.test.ts +++ b/frontend-next-migration/src/features/JoinClan/model/useJoinClan.test.ts @@ -30,13 +30,12 @@ describe('useJoinClan', () => { const { result } = renderHook(() => useJoinClan()); await act(async () => { - await result.current.handleJoin('clan_id', 'player_id', 'join_message'); + await result.current.handleJoin('clan_id', 'player_id'); }); expect(mockJoinClan).toHaveBeenCalledWith({ clan_id: 'clan_id', player_id: 'player_id', - join_message: 'join_message', }); expect(toast.success).toHaveBeenCalledWith('toast_join_success'); }); @@ -48,13 +47,12 @@ describe('useJoinClan', () => { const { result } = renderHook(() => useJoinClan()); await act(async () => { - await result.current.handleJoin('clan_id', 'player_id', 'join_message'); + await result.current.handleJoin('clan_id', 'player_id'); }); expect(mockJoinClan).toHaveBeenCalledWith({ clan_id: 'clan_id', player_id: 'player_id', - join_message: 'join_message', }); expect(toast.error).toHaveBeenCalledWith(`"${errorMessage}"`); }); @@ -66,7 +64,7 @@ describe('useJoinClan', () => { const { result } = renderHook(() => useJoinClan()); await act(async () => { - await result.current.handleJoin('clan_id', 'player_id', 'join_message', onSuccessMock); + await result.current.handleJoin('clan_id', 'player_id', onSuccessMock); }); expect(onSuccessMock).toHaveBeenCalled(); diff --git a/frontend-next-migration/src/features/JoinClan/model/useJoinClan.ts b/frontend-next-migration/src/features/JoinClan/model/useJoinClan.ts index f7cc33f86..d3f2e9905 100644 --- a/frontend-next-migration/src/features/JoinClan/model/useJoinClan.ts +++ b/frontend-next-migration/src/features/JoinClan/model/useJoinClan.ts @@ -7,13 +7,8 @@ const useJoinClan = () => { const [joinClan] = useJoinClanMutation(); // todo good function should not use too much params, think if you could group some or all params to object group(s) - const handleJoin = async ( - clan_id: string, - player_id: string, - join_message: string, - onSuccess?: () => void, - ) => { - const result = await joinClan({ clan_id, player_id, join_message }); + const handleJoin = async (clan_id: string, player_id: string, onSuccess?: () => void) => { + const result = await joinClan({ clan_id, player_id }); // @ts-ignore todo figure out ts if (result?.error) { // @ts-ignore todo figure out ts diff --git a/frontend-next-migration/src/preparedPages/ClanPages/ui/_components/clanoverview/buttonField/ButtonField.tsx b/frontend-next-migration/src/preparedPages/ClanPages/ui/_components/clanoverview/buttonField/ButtonField.tsx index cc1252a85..63738d25b 100644 --- a/frontend-next-migration/src/preparedPages/ClanPages/ui/_components/clanoverview/buttonField/ButtonField.tsx +++ b/frontend-next-migration/src/preparedPages/ClanPages/ui/_components/clanoverview/buttonField/ButtonField.tsx @@ -211,7 +211,7 @@ const ClanInfo = (props: Props) => { className={cls.JoinClanBtn} theme={ButtonTheme.Graffiti} size={ButtonSize.L} - onClick={() => handleJoin(clanData._id, playerId ?? '', 'join')} + onClick={() => handleJoin(clanData._id, playerId ?? '')} > {joinClanBtn}