diff --git a/apps/st/app/(main)/(with-base-layout)/layout.tsx b/apps/st/app/(main)/(with-base-layout)/layout.tsx index 287cc4c38..16baba982 100644 --- a/apps/st/app/(main)/(with-base-layout)/layout.tsx +++ b/apps/st/app/(main)/(with-base-layout)/layout.tsx @@ -19,7 +19,7 @@ import { import { useStatisticsTabUrlSync } from "@/shared/lib/use-statistics-tab-url-sync"; import { isVerificationSelectionReportMenu } from "@/shared/lib/verification-selection-report"; import { StatisticsPageLayout } from "@/shared/ui/statistics-page-layout"; -import { tokenManager } from "@/entities/auth"; +import { authService } from "@/entities/auth"; import type { MenuItem } from "@/entities/menu"; import { MenuApi } from "@/entities/menu"; import { BaseLayout } from "@common/components"; @@ -243,7 +243,7 @@ function WithBaseLayoutInner({ children }: { children: React.ReactNode }) { return ( diff --git a/apps/st/src/entities/auth/api/auth-service.ts b/apps/st/src/entities/auth/api/auth-service.ts index 0bef2fee3..ea77f8a36 100644 --- a/apps/st/src/entities/auth/api/auth-service.ts +++ b/apps/st/src/entities/auth/api/auth-service.ts @@ -5,14 +5,18 @@ import { ENDPOINT, } from "@/shared/config"; import { getCookie } from "@/shared/lib"; -import { getRemainingMs } from "@common/auth"; +import { + type AuthPayload, + type AuthService, + getRemainingMs, +} from "@common/auth"; import { clearAuthToken, + clearRefreshTimer, setToken, setupRefreshTimer, } from "../lib/token-manager"; -import type { AuthPayload, AuthService } from "../model/auth-interface"; import { clearTabStorePersist } from "@/store/tab-store"; @@ -96,5 +100,6 @@ export async function logout(): Promise { export const authService: AuthService = { login, silentRefresh, + declineSessionExtend: clearRefreshTimer, logout, }; diff --git a/apps/st/src/entities/auth/lib/token-manager.ts b/apps/st/src/entities/auth/lib/token-manager.ts index d449e711b..85574f244 100644 --- a/apps/st/src/entities/auth/lib/token-manager.ts +++ b/apps/st/src/entities/auth/lib/token-manager.ts @@ -4,12 +4,13 @@ import { createTokenManager } from "@common/auth"; export const tokenManager = createTokenManager(authConfig); export const { - getToken, - setToken, - removeToken, - setupRefreshTimer, - clearAuthToken, - getAccessToken, - getRefreshToken, - getUserId, + getToken, + setToken, + removeToken, + setupRefreshTimer, + clearRefreshTimer, + clearAuthToken, + getAccessToken, + getRefreshToken, + getUserId, } = tokenManager; diff --git a/apps/st/src/entities/auth/model/auth-interface.ts b/apps/st/src/entities/auth/model/auth-interface.ts deleted file mode 100644 index 9f76aaf35..000000000 --- a/apps/st/src/entities/auth/model/auth-interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface AuthPayload { - userId: string; - password: string; -} - -export interface AuthService { - login(payload: AuthPayload): Promise; - silentRefresh(): Promise; - logout(): Promise; -} diff --git a/apps/st/tsconfig.json b/apps/st/tsconfig.json index 7e8241dc4..d5062feda 100644 --- a/apps/st/tsconfig.json +++ b/apps/st/tsconfig.json @@ -22,9 +22,8 @@ "name": "next" } ], - "baseUrl": "./src", "paths": { - "@/*": ["./*"] + "@/*": ["./src/*"] } }, "include": [