Merge branch 'frontend' into gruppDM
This commit is contained in:
commit
17c30f5dd9
1 changed files with 2 additions and 9 deletions
|
@ -42,10 +42,7 @@ interface API {
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<APIResponse<NewWeeklyReport>>;
|
): Promise<APIResponse<NewWeeklyReport>>;
|
||||||
/** Gets all the projects of a user*/
|
/** Gets all the projects of a user*/
|
||||||
getUserProjects(
|
getUserProjects(token: string): Promise<APIResponse<Project[]>>;
|
||||||
username: string,
|
|
||||||
token: string,
|
|
||||||
): Promise<APIResponse<Project[]>>;
|
|
||||||
/** Gets a project from id*/
|
/** Gets a project from id*/
|
||||||
getProject(id: number): Promise<APIResponse<Project>>;
|
getProject(id: number): Promise<APIResponse<Project>>;
|
||||||
}
|
}
|
||||||
|
@ -150,10 +147,7 @@ export const api: API = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async getUserProjects(
|
async getUserProjects(token: string): Promise<APIResponse<Project[]>> {
|
||||||
username: string,
|
|
||||||
token: string,
|
|
||||||
): Promise<APIResponse<Project[]>> {
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/getUserProjects", {
|
const response = await fetch("/api/getUserProjects", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -161,7 +155,6 @@ export const api: API = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: "Bearer " + token,
|
Authorization: "Bearer " + token,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ username }),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
Loading…
Reference in a new issue