Skip to content

Commit

Permalink
fix: issues with adding post to timeline (#682)
Browse files Browse the repository at this point in the history
* Update myriad.service.ts

* format fix
  • Loading branch information
RiXelanya authored Nov 22, 2023
1 parent b2a2ede commit e850573
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions src/endpoints/myriad/myriad.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ export class MyriadService {
data,
config,
);
console.log(res.data);
return res.data;
}

Expand Down Expand Up @@ -535,28 +534,29 @@ export class MyriadService {
timelineId: string;
}) {
try {
const body = {
createdBy: createdBy,
isNSFW: isNSFW,
mentions: [],
rawText: rawText,
status: 'published',
tags: [],
text: text,
selectedUserIds: selectedUserIds,
visibility: visibility,
selectedTimelineIds: [timelineId],
};
const res = await axios.post<any, AxiosResponse<Post>>(
`${this.myriadEndPoints}/user/posts`,
{
createdBy: createdBy,
isNSFW: isNSFW,
mentions: [],
rawText: rawText,
status: 'published',
tags: [],
text: text,
selectedUserIds: selectedUserIds,
visibility: visibility,
selectedTimelineIds: [timelineId],
},
body,
{
headers: {
Authorization: `Bearer ${jwt}`,
},
},
);

await this.addPostToTimeline(jwt, res.data.id, postType);
// await this.addPostToTimeline(jwt, res.data.id, postType, timelineId);

return res.data;
} catch (err) {
Expand All @@ -575,6 +575,7 @@ export class MyriadService {
jwt: string,
postId: string,
postType: E_PostType,
timelineId: string,
) {
try {
let adminToken = await this.cacheManager.get<string>('admin_token');
Expand All @@ -591,18 +592,16 @@ export class MyriadService {
adminToken = user.jwt_token;
}

await axios.post(
`${this.myriadEndPoints}/experiences/post`,
{
experienceIds: [this.getExperienceIdAdmin(postType)],
postId: postId,
},
{
headers: {
Authorization: `Bearer ${adminToken}`,
},
const body = {
experienceIds: [this.getExperienceIdAdmin(postType), timelineId],
postId: postId,
};

await axios.post(`${this.myriadEndPoints}/experiences/post`, body, {
headers: {
Authorization: `Bearer ${adminToken}`,
},
);
});
} catch (err) {
this.logger.error(err);
throw new HttpException(
Expand Down

0 comments on commit e850573

Please sign in to comment.