fix scope ui to enum, fix pubkey check

This commit is contained in:
nick-delirium 2024-09-03 11:32:32 +02:00
parent 8ba496277f
commit 7634db34db
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
3 changed files with 7 additions and 7 deletions

View file

@ -113,14 +113,14 @@ interface Props {
siteId: string;
sites: Map<string, any>;
onboarding: boolean;
spotOnly?: boolean;
scope: number;
}
function PrivateRoutes(props: Props) {
const { onboarding, sites, siteId } = props;
const hasRecordings = sites.some(s => s.recorded);
const redirectToOnboarding =
!onboarding && (localStorage.getItem(GLOBAL_HAS_NO_RECORDINGS) === 'true' || !hasRecordings);
!onboarding && (localStorage.getItem(GLOBAL_HAS_NO_RECORDINGS) === 'true' || !hasRecordings) && props.scope > 0;
const siteIdList: any = sites.map(({ id }) => id).toJS();
return (
@ -149,7 +149,7 @@ function PrivateRoutes(props: Props) {
path={SCOPE_SETUP}
component={enhancedComponents.ScopeSetup}
/>
{props.spotOnly ? <Redirect to={SPOTS_LIST_PATH} /> : null}
{props.scope === 1 ? <Redirect to={SPOTS_LIST_PATH} /> : null}
<Route
path="/integrations/"
render={({ location }) => {
@ -289,8 +289,8 @@ function PrivateRoutes(props: Props) {
export default connect((state: any) => ({
onboarding: state.getIn(['user', 'onboarding']),
scope: getScope(state),
sites: state.getIn(['site', 'list']),
siteId: state.getIn(['site', 'siteId']),
spotOnly: getScope(state) === 1,
tenantId: state.getIn(['user', 'account', 'tenantId']),
}))(PrivateRoutes);

View file

@ -185,7 +185,7 @@ export default class SpotStore {
checkIsProcessed = async (id: string) => {
try {
const { status } = await this.withLoader(() => {
return spotService.checkProcessingStatus(id);
return spotService.checkProcessingStatus(id, this.accessKey);
})
return status === 'processed';

View file

@ -97,8 +97,8 @@ export default class SpotService extends BaseService {
.catch(console.error)
}
async checkProcessingStatus(id: string) {
return this.client.get(`/spot/v1/spots/${id}/status`)
async checkProcessingStatus(id: string, accessKey?: string) {
return this.client.get(`/spot/v1/spots/${id}/status${accessKey ? `?key=${accessKey}` : ''}`)
.then(r => r.json())
.catch(console.error)
}