Skip to content

Commit

Permalink
(^◔ᴥ◔^) minor edits to the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducheved committed Mar 12, 2024
1 parent 6f6fede commit 18724bd
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 154 deletions.
1 change: 0 additions & 1 deletion bot/api/ImageProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ImageProcessor {
? `${apiServer}/api/v1/svg/process?format=${this.format}`
: `${apiServer}/api/v1/images/process?format=${this.format}`;

// Добавляем параметры optimize и quality, если они не пустые
if (this.optimize !== undefined && this.optimize !== null) {
url += `&optimize=${this.optimize}`;
}
Expand Down
2 changes: 1 addition & 1 deletion bot/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
FORMATS: ['JPEG', 'PNG', 'WEBP'],
OPTIMIZATIONS: ['optimize_yes', 'optimize_no'],
QUALITIES: ['Шакально', 'Нормально', 'Неплохо', 'Получше', 'Как есть'],
QUALITIES: ['5', '30', '60', '80', '100'],
QUALITY_VALUES: [5, 30, 60, 80, 100]
};
2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const menuExpandClass = computed(() => ({
<div
class="bg-gradient-to-r from-pink-100 via-pink-200 to-pink-300 dark:bg-gradient-to-r dark:from-purple-700 dark:via-purple-800 dark:to-purple-900">
<div class="container mt-6 sm:mt-6 md:mb-0 mb-6 sm:md-6 md:mb-0 mx-auto">
<div class="inline-block text-xs sm:text-xs md:text-lg dark-mode-switch-container ">
<div class="inline-block text-md sm:text-md md:text-lg dark-mode-switch-container ">
<transition name="slide" @before-enter="beforeEnter" @after-leave="afterLeave">
<div
class="inline-block z-1000 rounded-tl-lg bg-fuchsia-950 p-2 font-sans text-white shadow-lg dark:bg-rose-300 dark:text-gray-800"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { faUserSecret, faTree, faUser, faHeart, faFileImport, faPlus, faRulerCom
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';

axios.defaults.baseURL = import.meta.env.VITE_APP_API_URL;
axios.defaults.baseURL = import.meta.env.VITE_APP_API_URL || 'http://localhost:33250';

const app = createApp(App);
library.add(faUserSecret, faUser, faTree, faHeart, faGithub, faFileImport, faPlus, faRulerCombined, faImage, faClock, faCalendarAlt, faExpand);
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/utils/imageAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export async function submitForm(selectedFile, format, optimize, quality, height
'Content-Type': 'multipart/form-data',
},
responseType: 'arraybuffer',
timeout: 120000,
});

let binary = '';
Expand All @@ -55,7 +56,17 @@ export async function submitForm(selectedFile, format, optimize, quality, height

return { image, decodedJson };
} catch (error) {
console.error('Error processing image data:', error);
if (error.code === 'ECONNABORTED') {
console.error('Request timed out:', error);
} else if (error.response) {
console.error('Server responded with an error:', error.response.status);
console.error('Error data:', error.response.data);
} else if (error.request) {
console.error('No response received:', error.request);
} else {
console.error('Error setting up the request:', error.message);
}
console.error('Error config:', error.config);
}
}

Expand Down
Loading

0 comments on commit 18724bd

Please sign in to comment.