diff --git a/frontend/src/API/API.ts b/frontend/src/API/API.ts index 5c49a8d..a39ce9b 100644 --- a/frontend/src/API/API.ts +++ b/frontend/src/API/API.ts @@ -6,6 +6,7 @@ import { NewProject, UserProjectMember, WeeklyReport, + StrNameChange, } from "../Types/goTypes"; /** @@ -133,6 +134,16 @@ interface API { projectName: string, token: string, ): Promise>; + /** + * Changes the username of a user in the database. + * @param {StrNameChange} data The object containing the previous and new username. + * @param {string} token The authentication token. + * @returns {Promise>} A promise resolving to an API response. + */ + changeUserName( + data: StrNameChange, + token: string, + ): Promise>; } /** An instance of the API */ @@ -342,7 +353,9 @@ export const api: API = { if (!response.ok) { return { success: false, message: "Failed to get weekly report" }; } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const data = (await response.json()) as WeeklyReport; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment return { success: true, data }; } } catch (e) { @@ -484,4 +497,12 @@ export const api: API = { }); } }, + changeUserName: function ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _data: StrNameChange, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + token: string, + ): Promise> { + throw new Error("Function not implemented."); + }, };