Skip to content

Commit

Permalink
Minor fixes (#891)
Browse files Browse the repository at this point in the history
* fix(frontend): issue of cookie not being set

* fix(backend): safely unwrap times
  • Loading branch information
IgnisDa authored Jun 28, 2024
1 parent 4dde506 commit 18e5468
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion apps/backend/src/miscellaneous/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,11 @@ impl MiscellaneousService {
times_seen: seen.len(),
})
}
let times_season_seen = episodes.iter().map(|e| e.times_seen).min().unwrap();
let times_season_seen = episodes
.iter()
.map(|e| e.times_seen)
.min()
.unwrap_or_default();
seasons.push(UserMetadataDetailsShowSeasonProgress {
episodes,
times_seen: times_season_seen,
Expand Down
7 changes: 5 additions & 2 deletions apps/frontend/app/routes/api.auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
LoginUserDocument,
RegisterUserDocument,
} from "@ryot/generated/graphql/backend/graphql";
import { serialize } from "cookie";
import { type CookieSerializeOptions, serialize } from "cookie";
import { z } from "zod";
import { zx } from "zodix";
import { AUTH_COOKIE_NAME } from "~/lib/generals";
Expand Down Expand Up @@ -41,7 +41,10 @@ export const loader = unstable_defineLoader(async ({ request }) => {
});
if (loginUser.__typename === "LoginResponse") {
const cookies = await getCookiesForApplication(loginUser.apiKey);
const options = { maxAge: coreDetails.tokenValidForDays * 24 * 60 * 60 };
const options = {
maxAge: coreDetails.tokenValidForDays * 24 * 60 * 60,
path: "/",
} satisfies CookieSerializeOptions;
return redirect($path("/"), {
headers: combineHeaders(
{
Expand Down

0 comments on commit 18e5468

Please sign in to comment.