1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-25 15:59:38 +02:00

Enhance category management: update adventure category assignment logic, improve category display in UI components, and add dynamic sorting for category dropdown

This commit is contained in:
Sean Morley 2024-11-26 20:06:52 -05:00
parent adf45ff557
commit f878167a36
6 changed files with 441 additions and 429 deletions

View file

@ -405,16 +405,20 @@
console.log(adventure);
if (adventure.id === '') {
console.log(categories);
if (categories.some((category) => category.name === 'general')) {
adventure.category = categories.find((category) => category.name === 'general') as Category;
} else {
adventure.category = {
id: '',
name: 'general',
display_name: 'General',
icon: '🌍',
user_id: ''
};
if (adventure.category?.display_name == '') {
if (categories.some((category) => category.name === 'general')) {
adventure.category = categories.find(
(category) => category.name === 'general'
) as Category;
} else {
adventure.category = {
id: '',
name: 'general',
display_name: 'General',
icon: '🌍',
user_id: ''
};
}
}
let res = await fetch('/api/adventures', {
method: 'POST',