import { ApiCall } from "tsrpc";
import { ReqLog, ResLog } from "../../cross/protocols/clsl/PtlLog";
import { FightFun } from '../../public/fight';

export default async function (call: ApiCall<ReqLog, ResLog>) {
    if (call.req.result) {
        FightFun.saveLog(call.req.uid, 'clsl', call.req.result);
        call.succ({});
    } else {
        call.succ({
            logs: await FightFun.readLog(call.req.uid, 'clsl')
        });
    }
}