Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing achievement pic upload #249

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/views/admin/achievement/AchievementListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ toolbar.setup({ title: 'Управление достижениями', backUrl:
const achievements = ref<AchievementGet[]>([]);
const newName = ref('');
const newDescription = ref('');
const newPic = ref<File[] | undefined>(undefined);
const newPic = ref<File | undefined>(undefined);
const created = ref<boolean | undefined>(undefined);

onMounted(async () => {
Expand All @@ -29,11 +29,12 @@ onMounted(async () => {
async function createAchievement(
new_name: string,
new_description: string,
new_pic: File[] | undefined
new_pic: File | undefined
) {
console.log(new_pic, new_pic?.length);
if (new_pic === undefined || new_pic.length !== 1) return;
console.log(new_pic);
if (new_pic === undefined) return;
const new_pic_str = new_pic.toString();
console.log(new_pic_str);

const promise = apiClient.POST('/achievement/achievement', {
body: {
Expand Down Expand Up @@ -88,11 +89,10 @@ async function createAchievement(
prepend-icon="md:image"
accept="image/png"
:rules="[
(value: File[]) => {
(value: File) => {
return (
!value ||
value.length == 1 ||
value[0].size < 200000 ||
value.size < 200000 ||
'Размер изображения не должен превышать 200 KB!'
);
},
Expand Down
Loading