Skip to content

Commit 9698813

Browse files
committed
55
1 parent 84d4980 commit 9698813

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

src/pages/todos/_id.vue

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,12 @@
5454
:message="toastMessage"
5555
:type="toastAlertType"
5656
/>
57-
<div id="kossie">coder</div>
5857
</template>
5958

6059
<script>
6160
import { useRoute, useRouter } from 'vue-router';
6261
import axios from 'axios';
63-
import { ref, computed, onBeforeMount,onMounted, onBeforeUpdate, onUpdated, onBeforeUnmount, onUnmounted } from 'vue';
62+
import { ref, computed, onUnmounted } from 'vue';
6463
import _ from 'lodash';
6564
import Toast from '@/components/Toast.vue';
6665
@@ -69,27 +68,6 @@ export default {
6968
Toast
7069
},
7170
setup() {
72-
onBeforeMount(() => {
73-
console.log(document.querySelector('#kossie'))
74-
});
75-
onMounted(() => {
76-
console.log(document.querySelector('#kossie'))
77-
});
78-
onBeforeUpdate(() => {
79-
console.log('before updat');
80-
})
81-
82-
onUpdated(() => {
83-
console.log('updated')
84-
})
85-
onBeforeUnmount(() => {
86-
console.log('before unmount')
87-
})
88-
89-
onUnmounted(() => {
90-
console.log('unmounted')
91-
})
92-
console.log('hello')
9371
const route = useRoute();
9472
const router = useRouter();
9573
const todo = ref(null);
@@ -98,8 +76,13 @@ console.log(document.querySelector('#kossie'))
9876
const showToast = ref(false);
9977
const toastMessage = ref('');
10078
const toastAlertType = ref('');
79+
const timeout = ref(null);
10180
const todoId = route.params.id
10281
82+
onUnmounted(() => {
83+
clearTimeout(timeout.value);
84+
})
85+
10386
const getTodo = async () => {
10487
try {
10588
const res = await axios.get(`
@@ -136,11 +119,11 @@ console.log(document.querySelector('#kossie'))
136119
toastMessage.value = message;
137120
toastAlertType.value = type;
138121
showToast.value = true;
139-
setTimeout(() => {
122+
timeout.value = setTimeout(() => {
140123
toastMessage.value = '';
141124
toastAlertType.value = '';
142125
showToast.value = false;
143-
}, 3000)
126+
}, 5000)
144127
}
145128
146129
const onSave = async () => {

0 commit comments

Comments
 (0)