Hi Guys,
I am trying to add class to the component while video being upload. But i got the below error while i am doing that.
ogramDetails.vue:1482 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'className')
Here is the HTML component.
<div class="col-12 position-absolute cursor-pointer text-center pt-3 mt-4">
<div id="upload-spin"></div>
</div>
Here is the function for upload.
async uploadMedia(url, file, mediaType, video = false) {
const headers = {
'Content-Type': file.type,
}
let publish = !!(this.program.published_at);
//upload-spin
var d = document.getElementById("upload-spin");
d.className += "spin";
await this.$axios
.put(url, file, { headers })
.then((response) => {
this.$notify({
group: 'all',
type: 'success',
text: mediaType + ' ' + this.$t('update_success'),
})
if (video){
var spinElement = document.querySelector('.spin');
spinElement.style.display = 'none';
}
if(video) {
this.save(publish);
}
})
.catch(({ response }) => {
this.errors = response.data.errors
this.$notify({
group: 'all',
type: 'error',
text: mediaType + ' ' + this.$t('update_fail'),
})
})
this.submitStatus = 'OK'
},