diff --git a/.gitignore b/.gitignore
index d316c39..c0b332f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
-hesabixArchive/
+
hesabixBackup/
backup/
.idea/
diff --git a/hesabixArchive/avatars/default.png b/hesabixArchive/avatars/default.png
new file mode 100644
index 0000000..f945669
Binary files /dev/null and b/hesabixArchive/avatars/default.png differ
diff --git a/hesabixArchive/avatars/index.php b/hesabixArchive/avatars/index.php
new file mode 100755
index 0000000..b3d9bbc
--- /dev/null
+++ b/hesabixArchive/avatars/index.php
@@ -0,0 +1 @@
+ ({
items: [],
+ timeoutId: null as number | null, // برای ذخیره ID تایمر
}),
- components: {
-
- },
+ components: {},
mounted() {
this.loadData();
},
+ beforeUnmount() {
+ // پاک کردن تایمر هنگام تخریب کامپوننت
+ if (this.timeoutId) {
+ clearTimeout(this.timeoutId);
+ }
+ },
methods: {
jump(item) {
axios.post('/api/notifications/read/' + item.id).then((response) => {
if (item.url.startsWith('http')) {
window.location.href = item.url;
- }
- else {
+ } else {
this.$router.push(item.url);
}
-
- })
+ });
},
loadData() {
axios.post('/api/notifications/list/new').then((response) => {
if (response.data.length != 0) {
this.items = response.data;
- }
- else {
+ } else {
this.items = [];
}
+ }).finally(() => {
+ // تنظیم تایمر جدید و ذخیره ID آن
+ this.timeoutId = setTimeout(this.loadData, 10000);
});
- setTimeout(this.loadData, 10000);
}
}
-
-})
+});
@@ -71,7 +74,6 @@ export default defineComponent({
prepend-icon="mdi-eye" />
-
diff --git a/webUI/src/views/acc/component/notifications/icon.vue b/webUI/src/views/acc/component/notifications/icon.vue
index 8131ca5..b508646 100644
--- a/webUI/src/views/acc/component/notifications/icon.vue
+++ b/webUI/src/views/acc/component/notifications/icon.vue
@@ -3,37 +3,45 @@ import axios from "axios";
export default {
name: "icon",
- data: ()=>{return{
- items:undefined,
- }},
- created() {
- this.loadData()
+ data: () => {
+ return {
+ items: undefined,
+ timeoutId: null, // برای ذخیره ID تایمر
+ };
},
- methods:{
- jump(item){
- axios.post('/api/notifications/read/' + item.id).then((response)=>{
- if(item.url.startsWith('http')){
- window.location.href = item.url;
- }
- else{
- this.$router.push(item.url);
- }
-
- })
- },
- loadData(){
- axios.post('/api/notifications/list/new').then((response)=>{
- if(response.data.length !== 0){
- this.items = response.data;
- }
- else{
- this.items = undefined;
+ created() {
+ this.loadData();
+ },
+ beforeDestroy() { // یا destroyed بسته به نسخه Vue
+ // پاک کردن تایمر هنگام تخریب کامپوننت
+ if (this.timeoutId) {
+ clearTimeout(this.timeoutId);
+ }
+ },
+ methods: {
+ jump(item) {
+ axios.post('/api/notifications/read/' + item.id).then((response) => {
+ if (item.url.startsWith('http')) {
+ window.location.href = item.url;
+ } else {
+ this.$router.push(item.url);
}
});
- setTimeout(this.loadData, 10000);
- }
- }
-}
+ },
+ loadData() {
+ axios.post('/api/notifications/list/new').then((response) => {
+ if (response.data.length !== 0) {
+ this.items = response.data;
+ } else {
+ this.items = undefined;
+ }
+ }).finally(() => {
+ // تنظیم تایمر جدید و ذخیره ID آن
+ this.timeoutId = setTimeout(this.loadData, 10000);
+ });
+ },
+ },
+};
@@ -74,5 +82,4 @@ export default {
\ No newline at end of file