<template>
    <activate-account-page 
        v-if="!! activation"
        :app="app"
        :customer="customer"
        :user="user"
    />
</template>

<script>
    export default {
        props: {
            app: {require: true},
        },

        data: () => ({
            customer: null,
            user: null,
            activation: null,
        }),

        created() {
            this.app.AddClassesByContext(require.context('./../../Classes', true, /\.class.js$/i));
            this.app.AddFormsByContext(require.context('./../../Forms', true, /\.form.js$/i));
            this.app.AddRequestsByContext(require.context('./../../Requests', true, /\.request.js$/i));

            this.app.requests.GetInfosByToken.ResetData().SetData({
                token: this.app.payload.token
            }).Request(
                [
                    response => {
                        this.customer = response.payload.customer;
                        this.user = response.payload.user;
                        this.activation = response.payload.activation;
                        this.app.forms.Activateaccount.formprovider.activeRecord.has_password = ! this.user.activated_at; 
                    }
                ]
            )
        },

        
        name: 'Index',
    }
</script>