Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxidragon committed Dec 5, 2023
1 parent 0dd1b47 commit 21d0557
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions frontend/src/Pages/Projects/SingleProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ const SingleProject = () => {
<ProjectStatsModal
open={openStatsModal}
handleClose={() => setOpenStatsModal(false)}
id={editedProject.id}
projectId={editedProject.id}
/>
{edit && (
<EditProjectModal
open={edit}
handleClose={handleCloseEditModal}
project={editedProject}
updateProject={updateProject}
editProject={updateProject}
/>
)}
</>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/logic/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ export const getUsername = () => {
return localStorage.getItem("username");
};

export const logout = async () => {
export const logout = (): void => {
localStorage.removeItem("token");
localStorage.removeItem("username");
};

export const isUserLoggedIn = () => {
export const isUserLoggedIn = (): boolean => {
const token = localStorage.getItem("token");
return token !== null;
};

export const changePassword = async (
oldPassword: string,
newPassword: string,
) => {
): Promise<number> => {
const response = await backendRequest("auth/password/change/", "POST", true, {
old_password: oldPassword,
new_password: newPassword,
Expand All @@ -80,12 +80,12 @@ export const getUserData = async () => {
return await response.json();
};

export const updateUserData = async (data: UserData) => {
export const updateUserData = async (data: UserData): Promise<number> => {
const response = await backendRequest("auth/data/", "PUT", true, data);
return response.status;
};

export const forgotPassword = async (email: string) => {
export const forgotPassword = async (email: string): Promise<number> => {
const response = await backendRequest("auth/password/reset/", "POST", false, {
email: email,
});
Expand All @@ -108,7 +108,7 @@ export const resetPassword = async (token: string, newPassword: string) => {
};
};

export const updateAvatar = async (avatar: File) => {
export const updateAvatar = async (avatar: File): Promise<number> => {
const formData = new FormData();
formData.append("avatar", avatar as Blob);
const response = await backendRequestWithFiles(
Expand All @@ -129,7 +129,7 @@ export const getUserAvatar = async (userId: number) => {
};
};

export const removeAvatar = async () => {
export const removeAvatar = async (): Promise<number> => {
const response = await backendRequest(`auth/avatar/remove/`, "DELETE", true);
return response.status;
};
2 changes: 1 addition & 1 deletion frontend/src/logic/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const updateDocument = async (document: DocumentInterface) => {
};
};

export const deleteDocument = async (documentId: number) => {
export const deleteDocument = async (documentId: number): Promise<number> => {
const response = await backendRequest(
`documents/${documentId}/`,
"DELETE",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/logic/goalCategories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const getAllGoalCategories = async () => {
const response = await backendRequest(`goals/categories/all/`, "GET", true);
return await response.json();
};

export const createGoalCategory = async (title: string) => {
const response = await backendRequest("goals/categories/", "POST", true, {
title,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/logic/projectParticipants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const updateProjectParticipant = async (
};
};

export const deleteProjectParticipant = async (id: number) => {
export const deleteProjectParticipant = async (id: number): Promise<number> => {
const response = await backendRequest(
`projects/users/update/${id}/`,
"DELETE",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/logic/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const updateTask = async (task: Task) => {
};
};

export const deleteTask = async (taskId: string) => {
export const deleteTask = async (taskId: string): Promise<number> => {
const response = await backendRequest(`tasks/${taskId}/`, "DELETE", true);
return response.status;
};
4 changes: 3 additions & 1 deletion frontend/src/logic/timezones.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const timezones = [
import { Timezone } from "./interfaces";

export const timezones: Timezone[] = [
{
id: 1,
display_name: "Warsaw",
Expand Down

0 comments on commit 21d0557

Please sign in to comment.