From d74c03a8085cd2b4fc23c6c5db306319c0d83d3f Mon Sep 17 00:00:00 2001
From: FEARmeR
Date: Tue, 23 May 2023 16:42:45 +0100
Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8?=
=?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE?=
=?UTF-8?q?=D0=B5=D0=BA=D1=82=D0=B0=20=D1=85=D1=83=D0=B4=D0=BE-=D0=B1?=
=?UTF-8?q?=D0=B5=D0=B4=D0=BD=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?=
=?UTF-8?q?=D0=B5=D1=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../LandingPages/Project/EditProject.vue | 72 +++++++++++++++----
src/views/LandingPages/Project/Project.vue | 4 +-
2 files changed, 59 insertions(+), 17 deletions(-)
diff --git a/src/views/LandingPages/Project/EditProject.vue b/src/views/LandingPages/Project/EditProject.vue
index d01eb54..9823c5e 100644
--- a/src/views/LandingPages/Project/EditProject.vue
+++ b/src/views/LandingPages/Project/EditProject.vue
@@ -39,22 +39,56 @@ const getProject = async () => {
}
};
+const onFileChange = (event) => {
+ if (event.target.files.length > 0) {
+ const file = event.target.files[0];
+ projectData.value.featured_image = file;
+ }
+};
const updateProject = async () => {
- try {
- const headers = { 'Authorization': `Bearer ${token.value}` };
- const data = {
- title: projectData.value.title,
- description: projectData.value.description,
- demo_link: projectData.value.demo_link,
- source_link: projectData.value.source_link,
- tags: projectData.value.tags,
+ // try {
+ // const headers = { 'Authorization': `Bearer ${token.value}` };
+ // const data = {
+ // title: projectData.value.title,
+ // description: projectData.value.description,
+ // demo_link: projectData.value.demo_link,
+ // source_link: projectData.value.source_link,
+ // tags: projectData.value.tags,
+ // };
+ // const response = await axios.patch(`http://somebodyhire.me/api/projects/${projectId.value}/`, data, { headers });
+ // router.push(`/project/${response.data.id}`);
+ // }
+ try {
+ const tokenValue = token.value;
+ const headers = {
+ 'Authorization': `Bearer ${tokenValue}`,
+ 'Content-Type': 'multipart/form-data',
+ "X-CSRFToken": "{{ csrf_token }}"
};
- const response = await axios.patch(`http://somebodyhire.me/api/projects/${projectId.value}/`, data, { headers });
+
+ const formData = new FormData();
+
+ formData.append('title', projectData.value.title);
+ formData.append('description', projectData.value.description);
+ formData.append('demo_link', projectData.value.demo_link);
+ formData.append('source_link', projectData.value.source_link);
+
+ if (projectData.value.featured_image) {
+ formData.append('featured_image', projectData.value.featured_image);
+ };
+ // formData.append('tags', projectData.value.tags);
+
+ const response = await axios.patch(`http://somebodyhire.me/api/projects/${projectId.value}/`, formData, { headers });
router.push(`/project/${response.data.id}`);
- } catch (error) {
+
+
+ }
+
+
+ catch (error) {
debugText.value = `Error: ${JSON.stringify(error, null, 2)}`;
console.error(error);
}
@@ -81,18 +115,26 @@ onMounted(async() => {
+
+
+
+
+
+
+
Вы не являетесь владельцем проекта
diff --git a/src/views/LandingPages/Project/Project.vue b/src/views/LandingPages/Project/Project.vue
index 736cd58..320a80e 100644
--- a/src/views/LandingPages/Project/Project.vue
+++ b/src/views/LandingPages/Project/Project.vue
@@ -59,7 +59,7 @@ const getProject = async () => {
Feedback
-
+