Skip to content

Commit

Permalink
Added a return for getAvatarConfig within the mock backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Lizardguard committed Jan 8, 2025
1 parent 60500a7 commit be7dc64
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Components/Core/Adapters/BackendAdapter/BackendAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ export default class BackendAdapter implements IBackendPort {
return response.data;
}

async getAvatarConfig(userToken: string): Promise<string> {
const response = await axios.get<string>("/Player/Avatar", {
async getAvatarConfig(userToken: string): Promise<AvatarConfigTO> {
const response = await axios.get<AvatarConfigTO>("/Player/Avatar", {
headers: {
token: userToken,
},
Expand Down
44 changes: 33 additions & 11 deletions src/Components/Core/Adapters/BackendAdapter/MockBackendAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ export default class MockBackendAdapter implements IBackendPort {
});
}

async getAvatarConfig(userToken: string): Promise<string> {
return "avatarConfig-Response";
}

async updateAvatarConfig(
userToken: string,
avatarConfig: AvatarConfigTO,
): Promise<boolean> {
return true;
}

getWorldStatus(
userToken: string,
worldID: ComponentID,
Expand Down Expand Up @@ -360,4 +349,37 @@ export default class MockBackendAdapter implements IBackendPort {
MockAdaptivityElementStatusResponse.element.success = true;
}
}

// Avatar Config

async getAvatarConfig(userToken: string): Promise<AvatarConfigTO> {
return Promise.resolve({
// Face (all texture indices)
eyes: 0,
nose: 0,
mouth: 0,
eyebrows: 0,

// Hair
hair: "hairMediumPonytail",
beard: "beardMedium",
hairColor: { id: 8, nameKey: "Blue 1", hexColor: "#043675" },

// Accessories

// Clothes

// Body
skinColor: { id: 24, nameKey: "Orange 1", hexColor: "#b76000" },
roundness: 0.5, // 0-1 morph target weight
// TODO: add more body features
} as AvatarConfigTO);
}

async updateAvatarConfig(
userToken: string,
avatarConfig: AvatarConfigTO,
): Promise<boolean> {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default interface IBackendPort {
worldID,
}: ElementDataParams): Promise<AdaptivtyElementStatusResponse>;

getAvatarConfig(userToken: string): Promise<string>;
getAvatarConfig(userToken: string): Promise<AvatarConfigTO>;

updateAvatarConfig(
userToken: string,
Expand Down

0 comments on commit be7dc64

Please sign in to comment.