Fix for submitWeeklyReport ts API

This commit is contained in:
Imbus 2024-03-21 18:05:41 +01:00
parent ec362cfa3a
commit dbbe4da401

View file

@ -85,7 +85,7 @@ interface API {
submitWeeklyReport(
weeklyReport: NewWeeklyReport,
token: string,
): Promise<APIResponse<NewWeeklyReport>>;
): Promise<APIResponse<string>>;
/** Gets a weekly report for a specific user, project and week
* @param {string} projectName The name of the project.
@ -294,7 +294,7 @@ export const api: API = {
async submitWeeklyReport(
weeklyReport: NewWeeklyReport,
token: string,
): Promise<APIResponse<NewWeeklyReport>> {
): Promise<APIResponse<string>> {
try {
const response = await fetch("/api/submitWeeklyReport", {
method: "POST",
@ -312,8 +312,8 @@ export const api: API = {
};
}
const data = (await response.json()) as NewWeeklyReport;
return { success: true, data };
const data = await response.text();
return { success: true, message: data };
} catch (e) {
return {
success: false,