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