import { ref, computed } from 'vue';

const user = ref({});

export function useLogin() {
    function getUser() {
        const userData = user.value;
        user.value = {};
        return computed(() => {
            return {
                user: userData.user,
                password: userData.password,
                keepLogin: userData.keepLogin,
            };
        });
    }

    function setUser(data) {
        user.value = {
            user: data.user,
            password: data.password,
            keepLogin: data.keepLogin,
        };
    }

    return {
        getUser,
        setUser,
    };
}
