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

Remove redundant API for Teams and Profile page #1854

Merged
merged 15 commits into from
Jun 26, 2024
Merged
11 changes: 0 additions & 11 deletions app/controllers/internal_api/v1/profile_controller.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
# frozen_string_literal: true

class InternalApi::V1::ProfileController < InternalApi::V1::ApplicationController
def show
authorize :show, policy_class: ProfilePolicy
render :show, locals: { user: current_user }, status: :ok
end

def remove_avatar
authorize :remove_avatar, policy_class: ProfilePolicy
current_user.avatar.destroy
render json: { notice: "Avatar deleted successfully" }, status: :ok
end

def update
authorize :update, policy_class: ProfilePolicy
service = UpdateProfileSettingsService.new(current_user, user_params).process
Expand Down
20 changes: 0 additions & 20 deletions app/javascript/src/apis/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,10 @@ import axios from "./api";

const path = "/profile";

const index = () => axios.get(path);

const getAddress = id => axios.get(`/users/${id}/addresses`);

const update = payload => axios.put(`${path}`, payload);

const upadteAvatar = (payload, config) => axios.put(`${path}`, payload, config);

const createAddress = (userId, payload) =>
axios.post(`/users/${userId}/addresses`, payload);

const updateAddress = (userId, addressId, payload) =>
axios.put(`/users/${userId}/addresses/${addressId}`, payload);

const removeAvatar = () => axios.delete(`${path}/remove_avatar`);

const profileApi = {
index,
update,
removeAvatar,
getAddress,
updateAddress,
createAddress,
upadteAvatar,
};

export default profileApi;
4 changes: 2 additions & 2 deletions app/javascript/src/apis/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const updateTeamMember = (id, payload) => axios.put(`${path}/${id}`, payload);

const destroyTeamMemberAvatar = id => axios.delete(`${path}/${id}/avatar`);

const updateTeamMemberAvatar = (id, payload) =>
axios.put(`${path}/${id}/avatar`, payload);
const updateTeamMemberAvatar = (id, payload, config) =>
axios.put(`${path}/${id}/avatar`, payload, config);

const updateTeamMembers = payload =>
axios.put(`${path}/update_team_members`, payload);
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading