diff --git a/src/components/instance/InstanceBody.vue b/src/components/instance/InstanceBody.vue index e3844bf..1b17e27 100644 --- a/src/components/instance/InstanceBody.vue +++ b/src/components/instance/InstanceBody.vue @@ -8,7 +8,7 @@ -
+
({ tab: "settings", @@ -75,6 +82,12 @@ export default { "MyChats", ], }, + { + id: "profile", + icon: "mdi-account", + title: "Perfil", + components: ["ConnectionAlert", "BasicInfo", "Privacy"], + }, ], }), props: { diff --git a/src/components/instance/profile/BasicInfo.vue b/src/components/instance/profile/BasicInfo.vue new file mode 100644 index 0000000..1c45ef9 --- /dev/null +++ b/src/components/instance/profile/BasicInfo.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/src/components/instance/profile/ConnectionAlert.vue b/src/components/instance/profile/ConnectionAlert.vue new file mode 100644 index 0000000..27632db --- /dev/null +++ b/src/components/instance/profile/ConnectionAlert.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/src/components/instance/profile/Privacy.vue b/src/components/instance/profile/Privacy.vue new file mode 100644 index 0000000..5fddf94 --- /dev/null +++ b/src/components/instance/profile/Privacy.vue @@ -0,0 +1,224 @@ + + + + + diff --git a/src/services/instanceController.js b/src/services/instanceController.js index 0b83239..1096a1e 100644 --- a/src/services/instanceController.js +++ b/src/services/instanceController.js @@ -74,7 +74,7 @@ const deleteInstance = async (instanceName) => { import settings from "./instanceSettingsController.js"; import group from "./instanceGroupController.js"; import chat from "./instanceChatController.js"; - +import profile from "./instanceProfileController.js"; export default { fetchAll, create, @@ -84,6 +84,6 @@ export default { delete: deleteInstance, ...settings, group, - chat - + chat, + profile, }; diff --git a/src/services/instanceProfileController.js b/src/services/instanceProfileController.js new file mode 100644 index 0000000..d3f18c1 --- /dev/null +++ b/src/services/instanceProfileController.js @@ -0,0 +1,62 @@ + +import http from "../http-common"; + +const updateName = async (instanceName, name) => { + return await http + .post("/chat/updateProfileName/:instance", { name }, { + params: { + instance: instanceName + } + }) + .then((r) => r.data) + .catch((error) => { + throw error.response?.data || error.response || error; + }); +} + +const updateStatus = async (instanceName, status) => { + return await http + .post("/chat/updateProfileStatus/:instance", { status }, { + params: { + instance: instanceName + } + }) + .then((r) => r.data) + .catch((error) => { + throw error.response?.data || error.response || error; + }); +} + +const getPrivacy = async (instanceName) => { + return await http + .get("/chat/fetchPrivacySettings/:instance", { + params: { + instance: instanceName + } + }) + .then((r) => r.data) + .catch((error) => { + throw error.response?.data || error.response || error; + }); +} + +const updatePrivacy = async (instanceName, privacySettings) => { + return await http + .put("/chat/updatePrivacySettings/:instance", { privacySettings }, { + 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 +} \ No newline at end of file