Update the method signature in the API interface to use StrNameChange
This commit is contained in:
parent
03f6edd320
commit
9e2a3cca81
1 changed files with 21 additions and 0 deletions
|
@ -6,6 +6,7 @@ import {
|
|||
NewProject,
|
||||
UserProjectMember,
|
||||
WeeklyReport,
|
||||
StrNameChange,
|
||||
} from "../Types/goTypes";
|
||||
|
||||
/**
|
||||
|
@ -133,6 +134,16 @@ interface API {
|
|||
projectName: string,
|
||||
token: string,
|
||||
): Promise<APIResponse<UserProjectMember[]>>;
|
||||
/**
|
||||
* 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<APIResponse<void>>} A promise resolving to an API response.
|
||||
*/
|
||||
changeUserName(
|
||||
data: StrNameChange,
|
||||
token: string,
|
||||
): Promise<APIResponse<void>>;
|
||||
}
|
||||
|
||||
/** 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<APIResponse<void>> {
|
||||
throw new Error("Function not implemented.");
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue