Skip to content

Commit 108dcd5

Browse files
committed
Added type goal and fetch func
1 parent 5b43b92 commit 108dcd5

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

frontend/src/services/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export const createComplex = async (data: ComplexInput): Promise<Complex> => {
4646
return response.json();
4747
};
4848

49+
export const fetchComplex = async (id: string): Promise<Complex> => {
50+
const response = await fetch(`${API_BASE_URL}/complexes/${id}`);
51+
return response.json();
52+
};
53+
4954
/* Delete complex */
5055
export const deleteComplex = async (id: number): Promise<void> => {
5156
const response = await fetch(`${API_BASE_URL}/complexes/${id}`, {

frontend/src/types/complex.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,21 @@ export interface ComplexInput {
1111
content: string;
1212
category: string;
1313
}
14+
15+
export interface Goal {
16+
id: number;
17+
complex_id: number;
18+
surface_goal: string;
19+
underlying_goal: string;
20+
created_at: string;
21+
updated_at: string;
22+
}
23+
24+
export interface ActionInput {
25+
content: string;
26+
completed_at?: string;
27+
category: string;
28+
created_at: string;
29+
updated_at: string;
30+
goals?: Goal[];
31+
}

0 commit comments

Comments
 (0)