feat: deals viewer mode and links for viewers
This commit is contained in:
		@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user