Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions apps/app/pages/[workspaceSlug]/me/profile/activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,10 @@ const ProfileActivity = () => {
const router = useRouter();
const { workspaceSlug } = router.query;

const { data: userActivity } = useSWR(USER_ACTIVITY, () => userService.getUserActivity());

if (!userActivity) {
return (
<Loader className="space-y-5">
<Loader.Item height="40px" />
<Loader.Item height="40px" />
<Loader.Item height="40px" />
<Loader.Item height="40px" />
</Loader>
);
}
const { data: userActivity } = useSWR(
workspaceSlug ? USER_ACTIVITY : null,
workspaceSlug ? () => userService.getUserActivity(workspaceSlug.toString()) : null
);

return (
<WorkspaceAuthorizationLayout
Expand All @@ -56,7 +48,7 @@ const ProfileActivity = () => {
</div>
<SettingsNavbar profilePage />
</div>
{userActivity && userActivity.results.length > 0 && (
{userActivity ? (
<div>
<ul role="list" className="-mb-4">
{userActivity.results.map((activityItem: any, activityIdx: number) => {
Expand Down Expand Up @@ -226,6 +218,13 @@ const ProfileActivity = () => {
})}
</ul>
</div>
) : (
<Loader className="space-y-5">
<Loader.Item height="40px" />
<Loader.Item height="40px" />
<Loader.Item height="40px" />
<Loader.Item height="40px" />
</Loader>
)}
</div>
</WorkspaceAuthorizationLayout>
Expand Down
4 changes: 2 additions & 2 deletions apps/app/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class UserService extends APIService {
});
}

async getUserActivity(): Promise<IUserActivityResponse> {
return this.get("/api/users/activities/")
async getUserWorkspaceActivity(workspaceSlug: string): Promise<IUserActivityResponse> {
return this.get(`/api/users/workspaces/${workspaceSlug}/activities/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
Expand Down