Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"i18next": "^23.16.8",
"i18next-browser-languagedetector": "^8.0.3",
"lodash": "^4.17.21",
"lucide-react": "^0.294.0",
"lucide-react": "^0.575.0",
"next-themes": "^0.4.6",
"papaparse": "^5.5.2",
"qs": "^6.14.0",
"react": "^18.3.1",
Expand All @@ -89,6 +90,7 @@
"react-i18next": "^14.1.3",
"react-phone-number-input": "^3.4.11",
"react-player": "^2.16.0",
"sonner": "^2.0.7",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"uuid": "^9.0.1",
Expand Down
95 changes: 78 additions & 17 deletions web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions web/src/api/auth/accept-invite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { noAuthApi } from '@/common/no-auth-api';

export interface AcceptInviteRequest {
password: string;
confirmPassword: string;
invitationToken: string;
}

export async function acceptInvite(payload: AcceptInviteRequest): Promise<void> {
await noAuthApi.post<AcceptInviteRequest>('/auth/accept-invite', payload);
}

10 changes: 10 additions & 0 deletions web/src/api/auth/forgot-password.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { noAuthApi } from '@/common/no-auth-api';

export interface ForgotPasswordRequest {
email: string;
}

export async function requestPasswordReset(payload: ForgotPasswordRequest): Promise<void> {
await noAuthApi.post<ForgotPasswordRequest>('auth/forgot-password', payload);
}

6 changes: 6 additions & 0 deletions web/src/api/auth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './login';
export * from './accept-invite';
export * from './forgot-password';
export * from './reset-password';
export * from './set-password';

7 changes: 7 additions & 0 deletions web/src/api/auth/login.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { authApi, type ILoginResponse, type LoginDTO } from '@/common/auth-api';

export async function login(payload: LoginDTO): Promise<ILoginResponse> {
const response = await authApi.post<ILoginResponse>('auth/login', payload);
return response.data;
}

12 changes: 12 additions & 0 deletions web/src/api/auth/reset-password.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { noAuthApi } from '@/common/no-auth-api';

export interface ResetPasswordRequest {
password: string;
token: string;
email: string;
}

export async function resetPassword(payload: ResetPasswordRequest): Promise<void> {
await noAuthApi.post<ResetPasswordRequest>('auth/reset-password', payload);
}

11 changes: 11 additions & 0 deletions web/src/api/auth/set-password.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { authApi } from '@/common/auth-api';

export interface SetPasswordRequest {
aspNetUserId: string;
newPassword: string;
}

export async function setPassword(payload: SetPasswordRequest): Promise<void> {
await authApi.post<SetPasswordRequest>('auth/set-password', payload);
}

6 changes: 6 additions & 0 deletions web/src/api/election-event/delete-citizen-guide.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { authApi } from '@/common/auth-api';

export function deleteCitizenGuide(electionRoundId: string, guideId: string) {
return authApi.delete<void>(`/election-rounds/${electionRoundId}/citizen-guides/${guideId}`);
}

6 changes: 6 additions & 0 deletions web/src/api/election-event/delete-observer-guide.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { authApi } from '@/common/auth-api';

export function deleteObserverGuide(electionRoundId: string, guideId: string) {
return authApi.delete<void>(`/election-rounds/${electionRoundId}/observer-guide/${guideId}`);
}

18 changes: 18 additions & 0 deletions web/src/api/election-event/get-citizen-guide-details.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { authApi } from '@/common/auth-api';
import type { GuideModel } from '@/features/election-event/models/guide';

export async function getCitizenGuideDetails(
electionRoundId: string,
guideId: string
): Promise<GuideModel> {
const response = await authApi.get<GuideModel>(
`/election-rounds/${electionRoundId}/citizen-guides/${guideId}`
);

if (response.status !== 200) {
throw new Error('Failed to fetch citizen guide details');
}

return response.data;
}

15 changes: 15 additions & 0 deletions web/src/api/election-event/get-citizen-guides.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { authApi } from '@/common/auth-api';
import type { GuideModel } from '@/features/election-event/models/guide';

type CitizenGuidesResponse = {
guides: GuideModel[];
};

export async function getCitizenGuides(electionRoundId: string): Promise<CitizenGuidesResponse> {
const response = await authApi.get<CitizenGuidesResponse>(
`/election-rounds/${electionRoundId}/citizen-guides`
);

return response.data;
}

11 changes: 11 additions & 0 deletions web/src/api/election-event/get-coalition-details.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { authApi } from '@/common/auth-api';
import type { Coalition } from '@/common/types';

export async function getCoalitionDetails(electionRoundId: string): Promise<Coalition> {
const response = await authApi.get<Coalition>(`/election-rounds/${electionRoundId}/coalitions:my`);

return {
...response.data,
};
}

11 changes: 11 additions & 0 deletions web/src/api/election-event/get-election-event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { authApi } from '@/common/auth-api';
import type { ElectionEvent } from '@/features/election-event/models/election-event';

export async function getElectionEvent(electionRoundId: string): Promise<ElectionEvent> {
const response = await authApi.get<ElectionEvent>(`/election-rounds/${electionRoundId}`);

return {
...response.data,
};
}

Loading
Loading