S
S
Syndr0me2018-12-20 15:20:28
PHP
Syndr0me, 2018-12-20 15:20:28

How to make login in lk on vue cli and php?

I am doing a project, while I started getting acquainted with vue cli, route and vuex, I ran into a problem. It is necessary to make authorization and registration of users. Before that, I implemented the usual reg through the php file, but now I want to do everything according to the API, since the SPA project, use JWT for this, but that's the question.
Let's say the user enters data in a pop-up window (inside the App.vue/mainpage.vue/reg.vue components), he has registered and received permission to enter his personal account, how can I draw new components inside the App.vue page already with all the internals of the personal cabinet, and not the main page?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nvdfxx, 2018-12-20
@Syndr0me

methods: {
    register() {
        registerFunc(url, email, pass)
            .then((res) => {
                this.$store.state.dispatch('setReg', true);
                this.$router.push('/myprofile')
            });
    }
}

M
Maxim Timofeev, 2018-12-20
@webinar

It's probably easier to reload the page after login and load new vue components. But you can immediately pull them, I don’t see a problem other than the weight of the js file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question