import { ApiCall } from "tsrpc";
import { ReqRefresh, ResRefresh } from "../../shared/protocols/kbzz/PtlRefresh";
import { kbzzUserDb } from './ApiOpen';

export default async function (call: ApiCall<ReqRefresh, ResRefresh>) {

    let resCall = (await G.clientCross.callApi('kbzz/Refresh', { ...call.req })).res;

    kbzzUserDb().updateOne({ uid: call.uid, type: 'kbzzUser' }, { $set: { enemy: resCall.enemy } });

    call.succ({
        enemy: resCall.enemy
    });
}