import { MiniAppError, MiniAppErrorType } from '../miniAppError'; import BridgeFunction from './bridgeFunction'; import axios from 'axios'; class RemoveSavedFile extends BridgeFunction { name = 'removeSavedFile'; protected async executeFunction() { if (this.functionContext?.filePath) { const res = await axios.get('/removesavedfile', { params: { filePath: this.functionContext?.filePath, }, }); if (res?.status === 200) { return this.cbHandler?.success({}); } else { return this.cbHandler?.fail( new MiniAppError(MiniAppErrorType.invalidPath) ); } } else { return this.cbHandler?.fail( new MiniAppError(MiniAppErrorType.badRequestInsufficientParameter) ); } } } export default RemoveSavedFile;