Skip to content

Commit 77772de

Browse files
committed
chore: fix snyk errors
1 parent d2f985e commit 77772de

5 files changed

Lines changed: 7 additions & 6 deletions

File tree

server/src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import path from "path";
44
const __dirname = path.dirname(fileURLToPath(import.meta.url));
55

66
export const PORT = 3001;
7-
export const JWT_SECRET = "local-dev-secret-do-not-use-in-production";
7+
export const JWT_SECRET =
8+
process.env.JWT_SECRET ?? "local-dev-secret-do-not-use-in-production";
89
export const DB_PATH = path.resolve(__dirname, "db/db.json");
910

1011
// AIDEV-NOTE: set to false to disable auth on all mutation routes (dev convenience)

src/features/auth/application/auth-store.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { createContext, useContext } from "react";
22
import { createStore, useStore } from "zustand";
33

4+
import { AUTH_KEY } from "@/features/auth/models/storage-keys";
45
import type { User } from "@/features/auth/models/user";
56
import { getUser } from "@/features/auth/providers/get-user";
67
import { AUTH_TOKEN_KEY } from "@/lib/http/ky-client";
78

89
import { loginUser, type ICredentials } from "../providers/login-user";
910

10-
const AUTH_KEY = "fake_store_is_authenticated";
11-
1211
// could be also https://www.npmjs.com/package/zustand-persist lib for advanced use cases
1312
const isLoggedIn = () => localStorage.getItem(AUTH_KEY) === "true";
1413

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// deepcode ignore HardcodedNonCryptoSecret: localStorage key name, not a secret value
2+
export const AUTH_KEY = "fake_store_is_authenticated";

src/features/authv2/application/AuthProvider.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { PropsWithChildren } from "react";
44
import { useEffect } from "react";
55
import { fromPromise } from "xstate";
66

7+
import { AUTH_KEY } from "@/features/auth/models/storage-keys";
78
import { getUser } from "@/features/auth/providers/get-user";
89
import { loginUser } from "@/features/auth/providers/login-user";
910
import { AuthContext } from "@/features/authv2/application/auth-context";
@@ -15,8 +16,6 @@ import {
1516
import { getRoles } from "@/features/authv2/providers/get-roles";
1617
import { sleep } from "@/lib/sleep";
1718

18-
const AUTH_KEY = "fake_store_is_authenticated";
19-
2019
export const AuthProvider = ({ children }: PropsWithChildren) => {
2120
const checkAuthStatus = () => {
2221
return Promise.resolve(localStorage.getItem(AUTH_KEY) === "true");

src/features/authv2/application/storage-machine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { assign, fromPromise, setup } from "xstate";
22

3-
const AUTH_KEY = "fake_store_is_authenticated";
3+
import { AUTH_KEY } from "@/features/auth/models/storage-keys";
44

55
interface StorageMachineContext {
66
isAuthenticated: boolean;

0 commit comments

Comments
 (0)