File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import path from "path";
44const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
55
66export 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" ;
89export 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)
Original file line number Diff line number Diff line change 11import { createContext , useContext } from "react" ;
22import { createStore , useStore } from "zustand" ;
33
4+ import { AUTH_KEY } from "@/features/auth/models/storage-keys" ;
45import type { User } from "@/features/auth/models/user" ;
56import { getUser } from "@/features/auth/providers/get-user" ;
67import { AUTH_TOKEN_KEY } from "@/lib/http/ky-client" ;
78
89import { 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
1312const isLoggedIn = ( ) => localStorage . getItem ( AUTH_KEY ) === "true" ;
1413
Original file line number Diff line number Diff line change 1+ // deepcode ignore HardcodedNonCryptoSecret: localStorage key name, not a secret value
2+ export const AUTH_KEY = "fake_store_is_authenticated" ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import type { PropsWithChildren } from "react";
44import { useEffect } from "react" ;
55import { fromPromise } from "xstate" ;
66
7+ import { AUTH_KEY } from "@/features/auth/models/storage-keys" ;
78import { getUser } from "@/features/auth/providers/get-user" ;
89import { loginUser } from "@/features/auth/providers/login-user" ;
910import { AuthContext } from "@/features/authv2/application/auth-context" ;
@@ -15,8 +16,6 @@ import {
1516import { getRoles } from "@/features/authv2/providers/get-roles" ;
1617import { sleep } from "@/lib/sleep" ;
1718
18- const AUTH_KEY = "fake_store_is_authenticated" ;
19-
2019export const AuthProvider = ( { children } : PropsWithChildren ) => {
2120 const checkAuthStatus = ( ) => {
2221 return Promise . resolve ( localStorage . getItem ( AUTH_KEY ) === "true" ) ;
Original file line number Diff line number Diff line change 11import { 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
55interface StorageMachineContext {
66 isAuthenticated : boolean ;
You can’t perform that action at this time.
0 commit comments