diff --git a/src/examples/navbars/NavbarDefault.vue b/src/examples/navbars/NavbarDefault.vue index a728fd5..1ac5db0 100644 --- a/src/examples/navbars/NavbarDefault.vue +++ b/src/examples/navbars/NavbarDefault.vue @@ -343,9 +343,23 @@ watch( Мой Профиль Рассказ о том, какой я классныйПросмотр + + + Редактирование + + Чтобы стать ещё более класснымСтраница добавления проекта @@ -376,11 +390,39 @@ watch( Мой профиль Рассказ о том, какой я классныйПросмотр + + + + Редактирование + + + + + Страница добавления проекта + diff --git a/src/views/LandingPages/Profile/EditProfile.vue b/src/views/LandingPages/Profile/EditProfile.vue index b89691f..8a9df2b 100644 --- a/src/views/LandingPages/Profile/EditProfile.vue +++ b/src/views/LandingPages/Profile/EditProfile.vue @@ -4,9 +4,6 @@ import { onMounted, ref, computed } from "vue"; import NavbarDefault from "../../../examples/navbars/NavbarDefault.vue"; import { useRouter } from "vue-router"; - - - const isAuthenticated = computed(() => !!sessionStorage.getItem('access_token')); const userId = computed(() => sessionStorage.getItem('user_id')); const loggedUserName = computed(() => sessionStorage.getItem('username')); @@ -14,10 +11,8 @@ const token = computed(() => sessionStorage.getItem('access_token')); const profileData = ref([]); const router = useRouter(); - const debugText = ref(''); - const getProfile = async () => { const profileDataRecieved = await axios.get(`http://somebodyhire.me/api/profile/${userId.value}/`); profileData.value = processProfileData(profileDataRecieved.data); @@ -25,21 +20,20 @@ const getProfile = async () => { const processProfileData = (data) => { return { - ...data, - name: data.name || '🤷 No Name Provided', - location: data.location || '🌍 No Location Provided', - short_intro: data.short_intro || '📝 No Short Intro Provided', - bio: data.bio || '📘 No Bio Provided', - profile_image: data.profile_image || '📷 No Image Provided', - social_github: data.social_github || '👨‍💻 No Github Provided', - social_twitter: data.social_twitter || '🐦 No Twitter Provided', - social_vk: data.social_vk || '🔵 No VK Provided', - social_youtube: data.social_youtube || '▶️ No YouTube Provided', - social_website: data.social_website || '🌐 No Website Provided', + name: data.name || '', + email: data.email || '', + username: data.username || '', + location: data.location || '', + short_intro: data.short_intro || '', + bio: data.bio || '', + social_github: data.social_github || '', + social_twitter: data.social_twitter || '', + social_vk: data.social_vk || '', + social_youtube: data.social_youtube || '', + social_website: data.social_website || '', }; }; -// Axios request and response interceptors axios.interceptors.request.use((request) => { debugText.value += '\n\nRequest:\n' + JSON.stringify(request, null, 2); return request; @@ -58,7 +52,7 @@ const updateProfile = async () => { const token = computed(() => sessionStorage.getItem('access_token')); debugText.value = `Type of token: ${typeof token.value}, Value of token: ${token.value}`; const headers = { 'Authorization': `Bearer ${token.value}` }; - await axios.put(`http://somebodyhire.me/api/profile/${userId.value}/`, profileData.value, { headers }); + await axios.patch(`http://somebodyhire.me/api/profile/${userId.value}/`, profileData.value, { headers }); router.push('/ViewMyProfile'); } catch (error) { debugText.value = `Error: ${JSON.stringify(error, null, 2)}`; @@ -66,7 +60,6 @@ const updateProfile = async () => { } }; - const cancelUpdate = () => { router.push('/ViewMyProfile'); }; @@ -74,42 +67,29 @@ const cancelUpdate = () => { onMounted(async() => { await getProfile(); }); - - - - - -