Refactor adventure category handling: update type definitions, enhance category management in UI components, and implement user-specific category deletion logic in the backend
This commit is contained in:
@@ -292,3 +292,16 @@ export function getRandomBackground() {
|
||||
const randomIndex = Math.floor(Math.random() * randomBackgrounds.backgrounds.length);
|
||||
return randomBackgrounds.backgrounds[randomIndex] as Background;
|
||||
}
|
||||
|
||||
export function findFirstValue(obj: any): any {
|
||||
for (const key in obj) {
|
||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||
const value = findFirstValue(obj[key]);
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
} else {
|
||||
return obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user