Skip to content

Commit

Permalink
Refactored variable names and types
Browse files Browse the repository at this point in the history
  • Loading branch information
CSantosM committed Oct 2, 2024
1 parent dd15407 commit dfcf8b3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/src/controllers/config.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ const logger = LoggerService.getInstance();

export const getConfig = async (req: Request, res: Response) => {
logger.verbose('Getting config');
const response = { isPrivate: CALL_PRIVATE_ACCESS === 'true' };
const response = { isPrivateAccess: CALL_PRIVATE_ACCESS === 'true' };
return res.status(200).json(response);
};
4 changes: 4 additions & 0 deletions frontend/src/app/core/models/server.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ServerConfigurationResponse {
isPrivateAccess: boolean;

}
7 changes: 4 additions & 3 deletions frontend/src/app/core/services/config.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Injectable } from '@angular/core';
import { HttpService } from '@services/http.service';
import { ServerConfigurationResponse } from '../models/server.model';

@Injectable({
providedIn: 'root'
})
export class ConfigService {
private config: { isPrivate: boolean } | undefined;
private config: ServerConfigurationResponse | undefined;
private initialization: Promise<void> | undefined;

constructor(private httpService: HttpService) {}
Expand All @@ -24,7 +25,7 @@ export class ConfigService {
} catch (error) {
console.error('Failed to load configuration:', error);
// Handle the error as needed, e.g., set default config or notify the user
this.config = { isPrivate: true }; // Default value in case of error
this.config = { isPrivateAccess: true }; // Default value in case of error
}
}

Expand All @@ -34,6 +35,6 @@ export class ConfigService {
throw new Error('ConfigService not initialized. Call initialize() before accessing config.');
}

return this.config?.isPrivate ?? true;
return this.config?.isPrivateAccess ?? true;
}
}

0 comments on commit dfcf8b3

Please sign in to comment.