mirror of
https://github.com/TeamPiped/Piped.git
synced 2026-06-02 12:54:34 +00:00
Migrate code to composition api.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user