Migrate code to composition api.

This commit is contained in:
Kavin
2026-03-27 00:41:48 +05:30
parent 2448b8aa1d
commit fa5bbbd267
50 changed files with 4506 additions and 4418 deletions

View File

@@ -2,15 +2,22 @@
<ErrorHandler v-if="response && response.error" :message="response.message" :error="response.error" />
</template>
<script>
export default {
activated() {
this.fetchJson(this.apiUrl() + "/clips/" + this.$route.params.clipId).then(response => {
this.response = response;
if (this.response.videoId) {
this.$router.push(`/watch?v=${this.response.videoId}`);
}
});
},
};
<script setup>
import { ref, onActivated } from "vue";
import { useRouter, useRoute } from "vue-router";
import { fetchJson } from "@/composables/useApi.js";
import { apiUrl } from "@/composables/useApi.js";
const router = useRouter();
const route = useRoute();
const response = ref(null);
onActivated(() => {
fetchJson(apiUrl() + "/clips/" + route.params.clipId).then(res => {
response.value = res;
if (response.value.videoId) {
router.push(`/watch?v=${response.value.videoId}`);
}
});
});
</script>