Skip to content

Commit

Permalink
Enable all CurrentUser related code and fix package liking
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksamies committed Jan 15, 2025
1 parent 45a59d3 commit e642687
Show file tree
Hide file tree
Showing 40 changed files with 818 additions and 666 deletions.
11 changes: 8 additions & 3 deletions apps/cyberstorm-remix/app/c/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
NewLink,
} from "@thunderstore/cyberstorm";
import "./Community.css";
import { getDapper } from "cyberstorm/dapper/sessionUtils";
// import { getDapper } from "cyberstorm/dapper/sessionUtils";
import { PackageSearch } from "~/commonComponents/PackageSearch/PackageSearch";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faBook } from "@fortawesome/free-solid-svg-icons";
Expand All @@ -16,6 +16,7 @@ import { ApiError } from "@thunderstore/thunderstore-api";
import { PackageOrderOptions } from "~/commonComponents/PackageSearch/PackageOrder";
import { faArrowUpRight } from "@fortawesome/pro-solid-svg-icons";
import { PageHeader } from "~/commonComponents/PageHeader/PageHeader";
import { DapperTs } from "@thunderstore/dapper-ts";

export const meta: MetaFunction<typeof loader> = ({ data }) => {
return [
Expand All @@ -27,7 +28,11 @@ export const meta: MetaFunction<typeof loader> = ({ data }) => {
export async function loader({ request, params }: LoaderFunctionArgs) {
if (params.communityId) {
try {
const dapper = await getDapper();
const dapper = new DapperTs({
apiHost: process.env.PUBLIC_API_URL,
sessionId: undefined,
csrfToken: undefined,
});
const searchParams = new URL(request.url).searchParams;
const ordering =
searchParams.get("ordering") ?? PackageOrderOptions.Updated;
Expand Down Expand Up @@ -79,7 +84,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
export async function clientLoader({ request, params }: LoaderFunctionArgs) {
if (params.communityId) {
try {
const dapper = await getDapper(true);
const dapper = window.Dapper;
const searchParams = new URL(request.url).searchParams;
const ordering =
searchParams.get("ordering") ?? PackageOrderOptions.Updated;
Expand Down
11 changes: 8 additions & 3 deletions apps/cyberstorm-remix/app/communities/communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ import {
useSearchParams,
} from "@remix-run/react";
import { Communities } from "@thunderstore/dapper/types";
import { getDapper } from "cyberstorm/dapper/sessionUtils";
// import { getDapper } from "cyberstorm/dapper/sessionUtils";
import { PageHeader } from "~/commonComponents/PageHeader/PageHeader";
import { DapperTs } from "@thunderstore/dapper-ts";

export const meta: MetaFunction = () => {
return [
Expand Down Expand Up @@ -69,7 +70,11 @@ export async function loader({ request }: LoaderFunctionArgs) {
const order = searchParams.get("order") ?? SortOptions.Popular;
const search = searchParams.get("search");
const page = undefined;
const dapper = await getDapper();
const dapper = new DapperTs({
apiHost: process.env.PUBLIC_API_URL,
sessionId: undefined,
csrfToken: undefined,
});
return await dapper.getCommunities(page, order ?? "", search ?? "");
// REMIX TODO: Add sentry and try except so, that we get a proper error page
// throw new Response("Community not found", { status: 404 });
Expand All @@ -80,7 +85,7 @@ export async function clientLoader({ request }: LoaderFunctionArgs) {
const order = searchParams.get("order") ?? SortOptions.Popular;
const search = searchParams.get("search");
const page = undefined;
const dapper = await getDapper(true);
const dapper = window.Dapper;
return await dapper.getCommunities(page, order ?? "", search ?? "");
// REMIX TODO: Add sentry and try except so, that we get a proper error page
// throw new Response("Community not found", { status: 404 });
Expand Down
Loading

0 comments on commit e642687

Please sign in to comment.