I am encountering an error that says "Cannot assign to 'name' because it is a constant or a read-only property" when trying to send data to the API. Does anyone know how I can solve this issue? Thank you.
onSubmit() {
const name = this.backUrl || 'admin';
console.log(name);
const formData = new FormData();
formData.append('avatar', this.form.get('avatar').value);
formData.append('name', name);
this.uploadService.uploadFile(formData).subscribe(
(res) => {
this.uploadResponse = res;
console.log(res);
},
(err) => {
console.log(err);
}
);
}