حذف بوکمارک

This commit is contained in:
Baghi 2025-04-19 11:24:19 +03:30
parent 6054491d1b
commit 88721dbb1a
3 changed files with 74 additions and 18 deletions

View File

@ -1,7 +1,7 @@
export default {
search: {
list: "repo/monir/search/@index_key/@search_type/@type_key/@listkey/@field_collapsed/@offset/@limit/@q=none",
show: "repo/public/get/byid/@index_key/@id",
show: "repo/public/get/byid/@index_key/@id/tbookmark",
synonym: "synonym/get/words",
prevNextHadith: "monir/next/@index_key/@vol_id/@parag_order/@step",
getDataTree: "@appname/book/tree/@offset/@limit/@vol_id/@q"

View File

@ -88,16 +88,7 @@ const removeFromFavorites = async (item = {}, index = 0) => {
v-for="(item, index) in props.list"
:key="index"
>
<div class="flex justify-end mt-2">
<UButton
v-if="route.name == 'hadithaFavorites'"
class=""
@click="removeFromFavorites(item)"
icon="i-haditha-close"
variant=""
/>
</div>
<div class="flex justify-between mt-4 mb-2">
<a
:href="`/haditha/search/${item?._source?.id}/${
item?._source?.meta?.hadith_masoum ??
@ -111,6 +102,16 @@ const removeFromFavorites = async (item = {}, index = 0) => {
item?._source?.meta?.hadith_sanad
}}
</a>
<UButton
v-if="route.name == 'hadithaFavorites'"
@click="removeFromFavorites(item)"
variant="ghost"
color="error"
class="copy-btn"
label="حذف"
/>
</div>
<a
@click.prevent="openModal(item)"
class="arabic-text block"
@ -353,4 +354,28 @@ const removeFromFavorites = async (item = {}, index = 0) => {
.modal-overlay {
background: #00000033;
}
.copy-btn {
padding: 0.2em 1em;
/* width: 44px; */
/* height: 24px; */
gap: 4px;
border-radius: 6px;
border-width: 0.5px;
padding-top: 4px;
padding-right: 12px;
padding-bottom: 4px;
padding-left: 12px;
/* background: #ffffff; */
/* border: 0.5px solid #d9d9d9; */
font-family: IRANSansX;
font-weight: 300;
font-size: 12px;
line-height: 18px;
letter-spacing: 0%;
text-align: right;
/* color: #a71111; */
}
</style>

View File

@ -132,6 +132,7 @@ const route = useRoute();
const router = useRouter();
const loading = ref(false);
const httpService = useNuxtApp()["$http"];
const toast = useToast();
const state = reactive({
selectedItem: {} as HadithResponseShowModel,
@ -202,6 +203,21 @@ const addToFavorites = async (item = {}) => {
};
httpService.postRequest(url, formData).then((res) => {
// this.updateListAnswer(index, "tbookmark", 1);
try {
toast.add({
title: "انجام شد.",
description: "به نشان شده ها افزوده شد",
color: "success",
});
} catch (err) {
console.log(err.message);
toast.add({
title: "انجام شد.",
description: "خطایی رخ داد.لطفا دوباره امتحان کنید.",
color: "error",
});
}
});
};
@ -217,6 +233,21 @@ const removeFromFavorites = async (item = {}, index = 0) => {
};
httpService.postRequest(url, formData).then((res) => {
// this.updateListAnswer(index, "tbookmark", 0);
try {
toast.add({
title: "انجام شد.",
description: "از لیست نشان شده ها حذف شد",
color: "success",
});
} catch (err) {
console.log(err.message);
toast.add({
title: "انجام شد.",
description: "خطایی رخ داد.لطفا دوباره امتحان کنید.",
color: "error",
});
}
});
};