|
|
|
@ -21,6 +21,8 @@ export class ConfigComponent implements OnInit {
|
|
|
|
|
max_friends_per_user: 100
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
localImageTypes: string[] = [];
|
|
|
|
|
|
|
|
|
|
constructor(private configService: ConfigService) {}
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
@ -30,12 +32,15 @@ export class ConfigComponent implements OnInit {
|
|
|
|
|
loadConfig(): void {
|
|
|
|
|
this.configService.loadConfig().subscribe(config => {
|
|
|
|
|
this.config = config;
|
|
|
|
|
this.localImageTypes = [...config.allowed_image_types];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveConfig(): void {
|
|
|
|
|
this.config.allowed_image_types = [...this.localImageTypes];
|
|
|
|
|
this.configService.saveConfig(this.config).subscribe(config => {
|
|
|
|
|
this.config = config;
|
|
|
|
|
this.localImageTypes = [...config.allowed_image_types];
|
|
|
|
|
alert('Configuration enregistrée avec succès');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -45,13 +50,15 @@ export class ConfigComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addImageType(): void {
|
|
|
|
|
this.config.allowed_image_types.push('');
|
|
|
|
|
this.localImageTypes.push('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeImageType(type: string): void {
|
|
|
|
|
const index = this.config.allowed_image_types.indexOf(type);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
this.config.allowed_image_types.splice(index, 1);
|
|
|
|
|
removeImageType(index: number): void {
|
|
|
|
|
this.localImageTypes.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateImageType(index: number, event: Event): void {
|
|
|
|
|
const input = event.target as HTMLInputElement;
|
|
|
|
|
this.localImageTypes[index] = input.value;
|
|
|
|
|
}
|
|
|
|
|
}
|