Skip to content

Commit

Permalink
Merge pull request #627 from Hariom01010/fix/update-users-self-api-en…
Browse files Browse the repository at this point in the history
…dpoint

Updated deprecated API endpoint from /users/self to /users?profile=true
  • Loading branch information
Hariom01010 authored Dec 13, 2024
1 parent c4936aa commit e4e6eb1
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/controllers/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default class ProfileController extends Controller {
e.preventDefault();
const cleanReqObject = this.removeEmptyFields(this.formData);
try {
const response = await fetch(`${BASE_URL}/users/self`, {
const response = await fetch(`${BASE_URL}/users?profile=true`, {
method: 'PATCH',
body: JSON.stringify(cleanReqObject),
headers: {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class ApplicationRoute extends Route {
const defaultPicture = 'dummyProfilePicture.png';

try {
const response = await fetch(`${API_BASE_URL}/users/self`, {
const response = await fetch(`${API_BASE_URL}/users?profile=true`, {
credentials: 'include',
});
const userData = await response.json();
Expand Down
9 changes: 6 additions & 3 deletions app/routes/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ export default class DiscordRoute extends Route {
}
);

const userResponse = await fetch(`${ENV.BASE_API_URL}/users/self`, {
credentials: 'include',
});
const userResponse = await fetch(
`${ENV.BASE_API_URL}/users?profile=true`,
{
credentials: 'include',
}
);

const externalAccountData = await externalAccountResponse.json();
const userData = await userResponse.json();
Expand Down
2 changes: 1 addition & 1 deletion app/routes/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class IdentityRoute extends Route {
@service toast;
async model() {
try {
const response = await fetch(`${ENV.BASE_API_URL}/users/self`, {
const response = await fetch(`${ENV.BASE_API_URL}/users?profile=true`, {
credentials: 'include',
});
const userData = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion app/routes/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class MobileRoute extends Route {

model = async () => {
try {
const response = await fetch(`${API_BASE_URL}/users/self`, {
const response = await fetch(`${API_BASE_URL}/users?profile=true`, {
credentials: 'include',
});
const userData = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion app/routes/new-signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class NewSignupRoute extends Route {
async model() {
try {
this.analytics.trackEvent(SIGNUP.PAGE_LOADED);
const response = await fetch(`${ENV.BASE_API_URL}/users/self`, {
const response = await fetch(`${ENV.BASE_API_URL}/users?profile=true`, {
credentials: 'include',
});
const userData = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion app/routes/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class ProfileRoute extends Route {
credentials: 'include',
});
const { developerRoleExistsOnUser } = await res.json();
const response = await fetch(`${ENV.BASE_API_URL}/users/self`, {
const response = await fetch(`${ENV.BASE_API_URL}/users?profile=true`, {
credentials: 'include',
});
const userData = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion app/routes/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class SignupRoute extends Route {
async model() {
try {
this.analytics.trackEvent(SIGNUP.PAGE_LOADED);
const response = await fetch(`${ENV.BASE_API_URL}/users/self`, {
const response = await fetch(`${ENV.BASE_API_URL}/users?profile=true`, {
credentials: 'include',
});
const userData = await response.json();
Expand Down
4 changes: 2 additions & 2 deletions app/utils/register-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ENV from 'website-my/config/environment';
const { BASE_API_URL } = ENV;

const registerUser = (user) =>
fetch(`${BASE_API_URL}/users/self`, {
fetch(`${BASE_API_URL}/users?profile=true`, {
method: 'PATCH',
body: JSON.stringify(user),
headers: {
Expand All @@ -13,7 +13,7 @@ const registerUser = (user) =>
});

const newRegisterUser = async (signupDetails, roles) => {
const getResponse = await fetch(`${BASE_API_URL}/users/self`, {
const getResponse = await fetch(`${BASE_API_URL}/users?profile=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Expand Down

0 comments on commit e4e6eb1

Please sign in to comment.