mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-10 21:33:20 +00:00
clear cache command
This commit is contained in:
22
src/commands/clearCache.command.ts
Normal file
22
src/commands/clearCache.command.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as program from 'commander';
|
||||
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
|
||||
import { ConfigurationService } from '../services/configuration.service';
|
||||
|
||||
import { Response } from 'jslib/cli/models/response';
|
||||
import { MessageResponse } from 'jslib/cli/models/response/messageResponse';
|
||||
|
||||
export class ClearCacheCommand {
|
||||
constructor(private configurationService: ConfigurationService, private i18nService: I18nService) { }
|
||||
|
||||
async run(cmd: program.Command): Promise<Response> {
|
||||
try {
|
||||
await this.configurationService.clearStatefulSettings(true);
|
||||
const res = new MessageResponse(this.i18nService.t('syncCacheCleared'), null);
|
||||
return Response.success(res);
|
||||
} catch (e) {
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user