mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-25 15:59:38 +02:00
Fix custom default category
This commit is contained in:
parent
17d8784d8c
commit
ce0b82acb7
10 changed files with 66 additions and 26 deletions
|
@ -404,6 +404,18 @@
|
|||
event.preventDefault();
|
||||
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: ''
|
||||
};
|
||||
}
|
||||
let res = await fetch('/api/adventures', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue