Fixed types and imports of types
This commit is contained in:
parent
8b6462abee
commit
5f42fa7818
5 changed files with 26 additions and 22 deletions
|
|
@ -1,13 +1,13 @@
|
|||
import { NewProjMember } from "../Components/AddMember";
|
||||
import { ProjectMember } from "../Components/GetUsersInProject";
|
||||
import {
|
||||
NewWeeklyReport,
|
||||
NewUser,
|
||||
User,
|
||||
Project,
|
||||
NewProject,
|
||||
UserProjectMember,
|
||||
WeeklyReport,
|
||||
StrNameChange,
|
||||
NewProjMember,
|
||||
} from "../Types/goTypes";
|
||||
|
||||
/**
|
||||
|
|
@ -137,7 +137,7 @@ interface API {
|
|||
getAllUsersProject(
|
||||
projectName: string,
|
||||
token: string,
|
||||
): Promise<APIResponse<UserProjectMember[]>>;
|
||||
): Promise<APIResponse<ProjectMember[]>>;
|
||||
/**
|
||||
* Changes the username of a user in the database.
|
||||
* @param {StrNameChange} data The object containing the previous and new username.
|
||||
|
|
@ -151,7 +151,7 @@ interface API {
|
|||
addUserToProject(
|
||||
user: NewProjMember,
|
||||
token: string,
|
||||
): Promise<APIResponse<NewProjMember>>;
|
||||
): Promise<APIResponse<void>>;
|
||||
|
||||
removeProject(
|
||||
projectName: string,
|
||||
|
|
@ -165,10 +165,7 @@ interface API {
|
|||
* @param {number} reportId The id of the report to sign
|
||||
* @param {string} token The authentication token
|
||||
*/
|
||||
signReport(
|
||||
reportId: number,
|
||||
token: string,
|
||||
): Promise<APIResponse<string>>;
|
||||
signReport(reportId: number, token: string): Promise<APIResponse<string>>;
|
||||
}
|
||||
|
||||
/** An instance of the API */
|
||||
|
|
@ -281,7 +278,7 @@ export const api: API = {
|
|||
async addUserToProject(
|
||||
user: NewProjMember,
|
||||
token: string,
|
||||
): Promise<APIResponse<NewProjMember>> {
|
||||
): Promise<APIResponse<void>> {
|
||||
try {
|
||||
const response = await fetch("/api/addUserToProject", {
|
||||
method: "PUT",
|
||||
|
|
@ -520,7 +517,7 @@ export const api: API = {
|
|||
async getAllUsersProject(
|
||||
projectName: string,
|
||||
token: string,
|
||||
): Promise<APIResponse<UserProjectMember[]>> {
|
||||
): Promise<APIResponse<ProjectMember[]>> {
|
||||
try {
|
||||
const response = await fetch(`/api/getUsersProject/${projectName}`, {
|
||||
method: "GET",
|
||||
|
|
@ -536,7 +533,7 @@ export const api: API = {
|
|||
message: "Failed to get users",
|
||||
});
|
||||
} else {
|
||||
const data = (await response.json()) as UserProjectMember[];
|
||||
const data = (await response.json()) as ProjectMember[];
|
||||
return Promise.resolve({ success: true, data });
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
@ -622,5 +619,5 @@ export const api: API = {
|
|||
} catch (e) {
|
||||
return { success: false, message: "Failed to sign report" };
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue