Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freelancer cannot see tenantUser tab #33

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Axios, { AxiosInstance, AxiosResponse } from 'axios';
import { isNaN } from 'lodash';
import { FishStocking, FishType, Tenant, TenantUser, User } from './types';

import { isEmpty } from 'lodash';
Expand Down Expand Up @@ -93,7 +92,8 @@ class Api {
config.url = this.proxy + config.url;
if (token) {
config.headers!.Authorization = 'Bearer ' + token;
if (!isNaN(profileId)) config.headers!['X-Profile'] = profileId;

if (profileId && !isNaN(profileId)) config.headers!['X-Profile'] = profileId;
LWangllix marked this conversation as resolved.
Show resolved Hide resolved
}

return config;
Expand Down
4 changes: 3 additions & 1 deletion src/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const useFilteredRoutes = () => {

return routes.filter((route) => {
if (!route?.slug) return false;
if (route.tenantOwner && profile?.role) {
if (route.tenantOwner) {
if (!profile?.role) return false;

return [RolesTypes.USER_ADMIN, RolesTypes.OWNER].includes(profile?.role);
}

Expand Down
Loading