feat: deals viewer mode and links for viewers

This commit is contained in:
2025-07-04 15:12:37 +04:00
parent 82e2ef6db2
commit c3d135eba9
27 changed files with 935 additions and 734 deletions

View File

@@ -4,6 +4,8 @@ import { jwtDecode, JwtPayload as JwtPayloadBase } from "jwt-decode";
interface AuthState {
isAuthorized: boolean;
accessToken: string;
isDealEditor: boolean;
isDealsViewer: boolean;
isGuest: boolean;
role: string;
}
@@ -16,6 +18,8 @@ const initialState = (): AuthState => {
return {
accessToken: "",
isAuthorized: false,
isDealEditor: false,
isDealsViewer: false,
isGuest: false,
role: "user",
};
@@ -37,7 +41,9 @@ const authSlice = createSlice({
state.accessToken = action.payload.accessToken;
state.isAuthorized = true;
state.role = role;
if (sub === "guest") state.isGuest = true;
state.isDealEditor = sub === "deal_editor";
state.isDealsViewer = sub === "deals_viewer";
state.isGuest = state.isDealEditor || state.isDealsViewer;
} catch (_) {
const url = window.location.href;
const urlObj = new URL(url);