From 7579b85cbfa004ee999014362c8bc65adfd59295 Mon Sep 17 00:00:00 2001 From: Gabriel Pastori <58153955+gabrielpastori1@users.noreply.github.com> Date: Fri, 8 Dec 2023 16:32:49 -0300 Subject: [PATCH] add profile picture Is hidden because the API not accept the image in base64 --- src/components/instance/InstanceBody.vue | 9 +- src/components/instance/InstanceHeader.vue | 11 +- src/components/instance/profile/Privacy.vue | 1 - .../instance/profile/ProfilePhoto.vue | 175 ++++++++++++++++++ src/services/instanceProfileController.js | 29 ++- 5 files changed, 214 insertions(+), 11 deletions(-) create mode 100644 src/components/instance/profile/ProfilePhoto.vue diff --git a/src/components/instance/InstanceBody.vue b/src/components/instance/InstanceBody.vue index 1b17e27..a28021e 100644 --- a/src/components/instance/InstanceBody.vue +++ b/src/components/instance/InstanceBody.vue @@ -37,6 +37,7 @@ import HasWhatsapp from "./message/HasWhatsapp.vue"; import ConnectionAlert from "./profile/ConnectionAlert.vue"; import BasicInfo from "./profile/BasicInfo.vue"; import Privacy from "./profile/Privacy.vue"; +import ProfilePhoto from "./profile/ProfilePhoto.vue"; export default { components: { Options, @@ -53,6 +54,7 @@ export default { ConnectionAlert, BasicInfo, Privacy, + ProfilePhoto, }, data: () => ({ tab: "settings", @@ -86,7 +88,12 @@ export default { id: "profile", icon: "mdi-account", title: "Perfil", - components: ["ConnectionAlert", "BasicInfo", "Privacy"], + components: [ + "ConnectionAlert", + "BasicInfo", + // "ProfilePhoto", + "Privacy", + ], }, ], }), diff --git a/src/components/instance/InstanceHeader.vue b/src/components/instance/InstanceHeader.vue index 8129ac4..ddfdb4d 100644 --- a/src/components/instance/InstanceHeader.vue +++ b/src/components/instance/InstanceHeader.vue @@ -7,20 +7,15 @@ {{ statusMapper[instance.instance.status].icon }} - +
diff --git a/src/components/instance/profile/Privacy.vue b/src/components/instance/profile/Privacy.vue index e4f223a..722577a 100644 --- a/src/components/instance/profile/Privacy.vue +++ b/src/components/instance/profile/Privacy.vue @@ -101,7 +101,6 @@ - + + diff --git a/src/services/instanceProfileController.js b/src/services/instanceProfileController.js index d3f18c1..433eb90 100644 --- a/src/services/instanceProfileController.js +++ b/src/services/instanceProfileController.js @@ -54,9 +54,36 @@ const updatePrivacy = async (instanceName, privacySettings) => { } +const removePicture = async (instanceName) => { + return await http + .delete("/chat/removeProfilePicture/:instance", { + params: { + instance: instanceName + } + }) + .then((r) => r.data) + .catch((error) => { + throw error.response?.data || error.response || error; + }); +} +const updatePicture = async (instanceName, picture) => { + return await http + .put("/chat/updateProfilePicture/:instance", { picture }, { + params: { + instance: instanceName + } + }) + .then((r) => r.data) + .catch((error) => { + throw error.response?.data || error.response || error; + }); +} + export default { updateName: updateName, updateStatus: updateStatus, getPrivacy: getPrivacy, - updatePrivacy: updatePrivacy + updatePrivacy: updatePrivacy, + removePicture: removePicture, + updatePicture: updatePicture, } \ No newline at end of file