Skip to content

Commit

Permalink
Show participant is sharing with DSP when allow_sites is null
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyi-gao-ttd committed Oct 6, 2023
1 parent e970517 commit a2538af
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/api/services/adminServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ const adminServiceClient = axios.create({
},
});

const DEFAULT_SHARING_SETTINGS: Pick<SharingListResponse, 'allowed_sites' | 'allowed_types'> = {
allowed_types: ['DSP'],
allowed_sites: [],
};

export const getSharingList = async (siteId: number): Promise<SharingListResponse> => {
try {
const response = await adminServiceClient.get<SharingListResponse>(
`/api/sharing/list/${siteId}`,
{
validateStatus: (status) => (status >= 200 && status < 300) || status === 404,
validateStatus: (status) => status >= 200 && status < 300,
}
);
return response.status === 200
return response.data.allowed_sites
? response.data
: {
allowed_sites: [],
allowed_types: [],
hash: 0,
};
: { ...response.data, ...DEFAULT_SHARING_SETTINGS };
} catch (error: unknown) {
const [logger] = getLoggers();
logger.error(`Get ACLs failed: ${error}`);
Expand All @@ -52,16 +53,12 @@ export const updateSharingList = async (
hash,
},
{
validateStatus: (status) => (status >= 200 && status < 300) || status === 404,
validateStatus: (status) => status >= 200 && status < 300,
}
);
return response.status === 200
return response.data.allowed_sites
? response.data
: {
allowed_sites: [],
allowed_types: [],
hash: 0,
};
: { ...response.data, ...DEFAULT_SHARING_SETTINGS };
} catch (error: unknown) {
const [logger] = getLoggers();
logger.error(`Update ACLs failed: ${error}`);
Expand Down

0 comments on commit a2538af

Please sign in to comment.