mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-01 09:30:58 -05:00
Fix bad useState practices
This commit is contained in:
15
lib/client/fetching.ts
Normal file
15
lib/client/fetching.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export async function fetchFeatures(setAllFeatures: any) {
|
||||
// results = []
|
||||
try {
|
||||
const res = await fetch('/api/interests');
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
for (const [id, values] of Object.entries(data)) {
|
||||
setAllFeatures(id, values || []);
|
||||
// results.push({id, values});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching feature options:', error);
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,14 @@ export interface ProfileData {
|
||||
promptAnswers: { prompt?: string; answer?: string, id?: string }[];
|
||||
images: string[];
|
||||
};
|
||||
}
|
||||
|
||||
export type DropdownKey = 'interests' | 'causeAreas' | 'connections' | 'coreValues';
|
||||
export type RangeKey = 'age' | 'introversion';
|
||||
|
||||
// type OtherKey = 'gender' | 'searchQuery';
|
||||
|
||||
export interface Item {
|
||||
id: DropdownKey;
|
||||
name: string;
|
||||
}
|
||||
Reference in New Issue
Block a user