These are chat archives for Automattic/mongoose

19th
Aug 2018
Keo
@Keo_Dara012_twitter
Aug 19 2018 02:37
@lineus i can fix it already
Maurizio Bellemo
@mbellemo_twitter
Aug 19 2018 07:07
@lineus 4.0.1
Kev
@lineus
Aug 19 2018 10:23
@mbellemo_twitter If it's a mongodb 4 replica set then you might want to check out transactions.
this blog post has a mongoose example about half way down the page.
Maurizio Bellemo
@mbellemo_twitter
Aug 19 2018 13:24
thanks
Maurizio Bellemo
@mbellemo_twitter
Aug 19 2018 13:43
stupid question.. how can i read an attribute of the header from a response? I would like to read the x_auth header of a login endpoint
[types.SIGN_UP](context, payload) {
        const root = 'http://localhost:4000';
        let url = `${root}/users`;

        return this.$axios.$post(url, {
            email: payload.email,
            password: payload.password,
            name: payload.name
        }).then(userAccount => {
            url = `${root}/users/login`;
            return this.$axios.$post(url, {
                email: payload.email,
                password: payload.password,
            }).then(user => {
                console.log(user);
                // read response header
                // const token = read x_auth header;
                // const userUid = user._id;
                return;
            });
        });
I would like to set the token const to the value which is present in the header of the response... how can I do it?