Add getUnsignedReportsInProject API method
This commit is contained in:
parent
8d6da684bf
commit
93659a72dc
1 changed files with 38 additions and 0 deletions
|
@ -159,6 +159,12 @@ interface API {
|
||||||
projectName: string,
|
projectName: string,
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<APIResponse<ProjectMember[]>>;
|
): Promise<APIResponse<ProjectMember[]>>;
|
||||||
|
|
||||||
|
getUnsignedReportsInProject(
|
||||||
|
projectName: string,
|
||||||
|
token: string,
|
||||||
|
): Promise<APIResponse<WeeklyReport[]>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the username of a user in the database.
|
* Changes the username of a user in the database.
|
||||||
* @param {StrNameChange} data The object containing the previous and new username.
|
* @param {StrNameChange} data The object containing the previous and new username.
|
||||||
|
@ -664,6 +670,38 @@ export const api: API = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async getUnsignedReportsInProject(
|
||||||
|
projectName: string,
|
||||||
|
token: string,
|
||||||
|
): Promise<APIResponse<WeeklyReport[]>> {
|
||||||
|
try {
|
||||||
|
const response = await fetch(`/api/getUnsignedReports/${projectName}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Authorization: "Bearer " + token,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message:
|
||||||
|
"Failed to get unsigned reports for project: Response code " +
|
||||||
|
response.status,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
const data = (await response.json()) as WeeklyReport[];
|
||||||
|
return { success: true, data };
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: "Failed to get unsigned reports for project, unknown error",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async changeUserName(
|
async changeUserName(
|
||||||
data: StrNameChange,
|
data: StrNameChange,
|
||||||
token: string,
|
token: string,
|
||||||
|
|
Loading…
Add table
Reference in a new issue