Merge branch 'dev' into gruppDM

This commit is contained in:
Davenludd 2024-04-09 18:18:02 +02:00
commit 1631c8b6b0
14 changed files with 1209 additions and 923 deletions

View file

@ -221,6 +221,15 @@ interface API {
*/
signReport(reportId: number, token: string): Promise<APIResponse<string>>;
/**
* Unsigns a report. Keep in mind that the user which the token belongs to must be
* the project manager of the project the report belongs to.
*
* @param {number} reportId The id of the report to sign
* @param {string} token The authentication token
*/
unsignReport(reportId: number, token: string): Promise<APIResponse<string>>;
/**
* Promotes a user to project manager within a project.
*
@ -846,6 +855,29 @@ export const api: API = {
}
},
async unsignReport(
reportId: number,
token: string,
): Promise<APIResponse<string>> {
try {
const response = await fetch(`/api/unsignReport/${reportId}`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
},
});
if (!response.ok) {
return { success: false, message: "Failed to unsign report" };
} else {
return { success: true, message: "Report unsigned" };
}
} catch (e) {
return { success: false, message: "Failed to unsign report" };
}
},
async promoteToPm(
userName: string,
projectName: string,