import { AgoraRTMessage } from '$utils/socket/agoraRTM/const/channel';
import {FlatListReload} from "$components/flat-list/const";
export default {

    created(){
        if (this.type === 'rowWheat') {

            this.agoraRTMIM.on(AgoraRTMessage.userRowWheat,({data})=>{

                if (this.$refs.flat) {
                    if (data.queueWheat && data.queueWheat.user && !this.$refs.flat.flat_is_loading()) {
                        if (data.queueWheat.status) {
                            this.$refs.flat.flat_unshift(data.queueWheat.user.uid,data.queueWheat.user);
                        } else {
                            this.$refs.flat.flat_delete(data.queueWheat.user.uid);
                        }
                    } else {
                        this.$refs.flat.reload(FlatListReload.mustReload);
                    }

                }



            });

        }
    }

}