getAllUsersProject uses new type
This commit is contained in:
parent
cd452459c2
commit
d1be752ac3
1 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ import {
|
||||||
User,
|
User,
|
||||||
Project,
|
Project,
|
||||||
NewProject,
|
NewProject,
|
||||||
PublicUser,
|
UserProjectMember,
|
||||||
} from "../Types/goTypes";
|
} from "../Types/goTypes";
|
||||||
|
|
||||||
// This type of pattern should be hard to misuse
|
// This type of pattern should be hard to misuse
|
||||||
|
@ -52,7 +52,7 @@ interface API {
|
||||||
getAllUsersProject(
|
getAllUsersProject(
|
||||||
projectName: string,
|
projectName: string,
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<APIResponse<PublicUser[]>>;
|
): Promise<APIResponse<UserProjectMember[]>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export an instance of the API
|
// Export an instance of the API
|
||||||
|
@ -318,7 +318,7 @@ export const api: API = {
|
||||||
async getAllUsersProject(
|
async getAllUsersProject(
|
||||||
projectName: string,
|
projectName: string,
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<APIResponse<PublicUser[]>> {
|
): Promise<APIResponse<UserProjectMember[]>> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/getUsersProject/${projectName}`, {
|
const response = await fetch(`/api/getUsersProject/${projectName}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -334,7 +334,7 @@ export const api: API = {
|
||||||
message: "Failed to get users",
|
message: "Failed to get users",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const data = (await response.json()) as User[];
|
const data = (await response.json()) as UserProjectMember[];
|
||||||
return Promise.resolve({ success: true, data });
|
return Promise.resolve({ success: true, data });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue