Skip to content

Commit

Permalink
#66 - fix: code review fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilpiech97 committed Aug 9, 2024
1 parent c116096 commit e5bc629
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions environment/dev/app/php.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[PHP]
memory_limit = 256M
upload_max_filesize = 40m
post_max_size = 50m

[xdebug]
xdebug.client_host=xdebug://gateway
Expand Down
18 changes: 13 additions & 5 deletions resources/js/Pages/Dashboard/Setting/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const form = useForm({
department_name: props.settings.department_name,
primary_color: props.settings.primary_color,
secondary_color: props.settings.secondary_color,
logo: props.settings.logo,
logo: null,
})
const imageUrl = ref('')
Expand All @@ -35,7 +35,15 @@ function updateSettings() {
}
function onFileSelected(event) {
form.logo = event.target?.files[0]
const file = event.target?.files[0]
if(file.size > 1024 * 1024) {

Check failure on line 40 in resources/js/Pages/Dashboard/Setting/Edit.vue

View workflow job for this annotation

GitHub Actions / Test & lint JS codebase

Expected space(s) after "if"
form.errors.logo = 'Plik nie może być większy niż 1MB'
return
}
form.logo = file
imageUrl.value = URL.createObjectURL(event.target?.files[0])
form.errors.logo = ''
}
Expand Down Expand Up @@ -116,8 +124,8 @@ function onFileSelected(event) {
>
<FormError :error="form.errors.logo" class="mt-2" />
</FormGroup>
<FormGroup v-if="form.logo || imageUrl">
<div v-if="form.logo && !imageUrl">
<FormGroup v-if="settings.logo || imageUrl">
<div v-if="settings.logo && !imageUrl">
<FormLabel class="mb-3 flex justify-between">
Aktualne logo
<InertiaLink
Expand All @@ -130,7 +138,7 @@ function onFileSelected(event) {
</InertiaLink>
</FormLabel>
<img :alt="'alt text'"
:src="`/storage/${form.logo}`"
:src="`/storage/${settings.logo}`"
class="m-auto shadow-lg"
>
</div>
Expand Down

0 comments on commit e5bc629

Please sign in to comment.