mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-09 09:59:40 -06:00
lint
This commit is contained in:
parent
be5760905e
commit
45e461e757
@ -273,19 +273,19 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
if (provider?.ENABLED) {
|
||||
const authState = await this.authStateProvider.authStateProvider(this.instance.id);
|
||||
|
||||
await authState.removeCreds()
|
||||
await authState.removeCreds();
|
||||
}
|
||||
|
||||
if (cache?.REDIS.ENABLED && cache?.REDIS.SAVE_INSTANCES) {
|
||||
const authState = await useMultiFileAuthStateRedisDb(this.instance.id, this.cache);
|
||||
|
||||
await authState.removeCreds()
|
||||
await authState.removeCreds();
|
||||
}
|
||||
|
||||
if (db.SAVE_DATA.INSTANCE) {
|
||||
const authState = await useMultiFileAuthStatePrisma(this.instance.id, this.cache);
|
||||
|
||||
await authState.removeCreds()
|
||||
await authState.removeCreds();
|
||||
}
|
||||
|
||||
const sessionExists = await this.prismaRepository.session.findFirst({ where: { sessionId: this.instanceId } });
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { prismaRepository } from '@api/server.module';
|
||||
import { CacheService } from '@api/services/cache.service';
|
||||
import { CacheConf, configService } from '@config/env.config';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { INSTANCE_DIR } from '@config/path.config';
|
||||
import { AuthenticationState, BufferJSON, initAuthCreds, WAProto as proto } from 'baileys';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import {Logger} from "@config/logger.config";
|
||||
|
||||
const fixFileName = (file: string): string | undefined => {
|
||||
if (!file) {
|
||||
@ -147,7 +147,6 @@ export default async function useMultiFileAuthStatePrisma(
|
||||
}
|
||||
|
||||
async function removeCreds(): Promise<any> {
|
||||
|
||||
const cacheConfig = configService.get<CacheConf>('CACHE');
|
||||
|
||||
// Redis
|
||||
@ -156,7 +155,7 @@ export default async function useMultiFileAuthStatePrisma(
|
||||
await cache.delete(sessionId);
|
||||
logger.info({ action: 'redis.delete', sessionId });
|
||||
|
||||
return
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
logger.warn({ action: 'redis.delete', sessionId, err });
|
||||
@ -209,6 +208,6 @@ export default async function useMultiFileAuthStatePrisma(
|
||||
return writeData(creds, 'creds');
|
||||
},
|
||||
|
||||
removeCreds
|
||||
removeCreds,
|
||||
};
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ import { isNotEmpty } from 'class-validator';
|
||||
|
||||
export type AuthState = {
|
||||
state: AuthenticationState;
|
||||
saveCreds: () => Promise<void>
|
||||
saveCreds: () => Promise<void>;
|
||||
removeCreds: () => Promise<void>;
|
||||
};
|
||||
|
||||
@ -91,7 +91,6 @@ export class AuthStateProvider {
|
||||
};
|
||||
|
||||
const removeCreds = async () => {
|
||||
|
||||
const [response, error] = await this.providerFiles.removeSession(instance);
|
||||
if (error) {
|
||||
// this.logger.error(['removeData', error?.message, error?.stack]);
|
||||
@ -144,7 +143,7 @@ export class AuthStateProvider {
|
||||
return await writeData(creds, 'creds');
|
||||
},
|
||||
|
||||
removeCreds
|
||||
removeCreds,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,6 @@ export async function useMultiFileAuthStateRedisDb(
|
||||
|
||||
async function removeCreds(): Promise<any> {
|
||||
try {
|
||||
|
||||
logger.warn({ action: 'redis.delete', instanceName });
|
||||
|
||||
return await cache.delete(instanceName);
|
||||
@ -89,6 +88,6 @@ export async function useMultiFileAuthStateRedisDb(
|
||||
return await writeData(creds, 'creds');
|
||||
},
|
||||
|
||||
removeCreds
|
||||
removeCreds,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user