Skip to content

Commit af2c11d

Browse files
authored
Upload avatar input
1 parent a4e9291 commit af2c11d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

input/AvatarInput.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const props = defineProps({
77
image: { default: 'https://i.pravatar.cc/128' },
88
label: { default: 'Select image' },
99
remove_avatar_url: { default: 'web/api/remove/avatar' },
10+
remove_success: { default: 'Avatar removed.' },
11+
remove_error: { default: 'Avatar not removed.' },
1012
})
1113
1214
const { image } = toRefs(props)
@@ -21,9 +23,9 @@ function getImagePath(e) {
2123
async function removeAvatar() {
2224
try {
2325
await axios.get(props.remove_avatar_url)
24-
alert('Avatar removed.')
26+
alert(props.remove_success)
2527
} catch (err) {
26-
alert('Avatar not removed.')
28+
alert(props.remove_error)
2729
}
2830
}
2931
</script>
@@ -43,7 +45,7 @@ async function removeAvatar() {
4345

4446
<img :src="image" class="avatar-image" />
4547

46-
<Input @change="getImagePath" :label="$t(props.label)" name="image" type="file" />
48+
<Input @change="getImagePath" :label="props.label" name="image" type="file" />
4749
</div>
4850
</div>
4951
</template>

0 commit comments

Comments
 (0)