Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaomiDEV committed Jul 28, 2024
1 parent f0afbd8 commit ee015df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/lib/db/entities/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ export async function newTag(tag: Omit<Tag, keyof UUIDable>) {

export async function removeTag(uuid: UUID){
const tag = await getTable().get(uuid);
console.log(tag);
if(tag?.type === "member"){
getMembers().toCollection().modify(member => {
await getMembers().toCollection().modify(member => {
console.log(member.tags);
member.tags = member.tags?.filter(tag => tag !== uuid)
console.log(member.tags);
});
} else if(tag?.type === "journal") {
getJournalPosts().toCollection().modify(journalPost => {
await getJournalPosts().toCollection().modify(journalPost => {
journalPost.tags = journalPost.tags?.filter(tag => tag !== uuid)
});
}
Expand Down
11 changes: 7 additions & 4 deletions src/views/tabbed/Members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,26 @@
IonFabButton,
IonIcon
} from '@ionic/vue';
import { inject, onMounted, provide, ref } from 'vue';
import { inject, onMounted, provide, ref, watch } from 'vue';
import { getFilteredMembers } from '../../lib/db/liveQueries';
import { addOutline as addIOS } from "ionicons/icons";
import addMD from "@material-design-icons/svg/outlined/add.svg";
import MemberEdit from '../../modals/MemberEdit.vue';
import MemberInList from '../../components/MemberInList.vue';
import { Tag, getTable as getTagsTable } from '../../lib/db/entities/tags';
import { from, useObservable } from '@vueuse/rxjs';
import { liveQuery } from 'dexie';
const isIOS = inject<boolean>("isIOS");
const tags = ref<Tag[]>([]);
provide("tags", tags);
onMounted(loadTags);
async function loadTags(){
watch([
useObservable(from(liveQuery(() => getTagsTable().toArray())))
], async () => {
tags.value = await getTagsTable().toArray();
}
}, { immediate: true });
const search = ref("");
const members = getFilteredMembers(search);
Expand Down

0 comments on commit ee015df

Please sign in to comment.