Logout custom component does not work

This forum contains topics that were moved from Get Satisfaction
xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

I have created 2 custom components (buttons):

(1.) one that takes to a page, and
(2.) another that logs out on click.

While the custom component with page navigation works, the one with logout service attached to it does not work. When I add these custom components to a page. Clicking on button from #1 above correctly navigates me to a new page. Clicking on #2 (logout button) does not do anything.

Yes, there is an actual working logout service connected to this button, which should fire on click. This logout service is working fine at other places in my app. I did check the "data" tab for the logout custom button and it has the "log out service" listed there.

Reproducing this is fairly simple:


(1.) Create a logout service (test that it works)
(2.) Create a button, call it "Log-out".
(3.) Execute logout service on click of "Log-out" button.
(4.) Now save this as a "custom component".
(5.) Create new page, add the "custom component" from #4 above to this page.
(6.) Test (click on the button created from custom component in #5 above does not log out).

--

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Logout custom component does not work

Post by Yurii Orishchuk »

Hi Xman,

I've tested the use case you have provided in description.

And can tell that it's work for me.

So please try this (modified workflow):

(1.) Create a logout service (test that it works)
(2.) Create a button, call it "Log-out".
(3.) Navigate to "logout" service datasource and add link from sessionToken LSV to seesionToken request parameter. See details: http://prntscr.com/4ev8ss/direct
(4.) Execute logout service on click of "Log-out" button.
(5.) Now save this as a "custom component".
(6.) Create new page, add the "custom component" from #4 above to this page.
(7.) Test (it will invoke "logout service" with correct "sessionToken". Please checkout it in your browser debugger "network" tab.) See details: http://prntscr.com/4ev9s4/direct

Please delete your previous custom component before make these steps.
And please follow these steps carefully.

Regards.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

Tried exactly the same, does nothing. The network tab shows the sessionID.
After I invoke this service, I start to get errors at other pages as well "Invalid Session Token".

The log out service is also mannually attached to another button. That log out button works just fine. But, if I create one more button and also map the logout service to this button, and then click it - the older/separate logout button that works fine also stops to work ...plus I start getting errors on other pages as well.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

Never mind! ...it was stupid of me to miss one important step.

The service works fine! ...thanks Yurii!

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

Spoke too early ...it does not work.

Where the button is created, the logout works fine. However, when I add this saved custom component to another page it does not work.

I checked the "Custom component" (in left side project window) by itself:
(1.) It has the click event saved to invoke the logout service.
(2.) It has logout service in it's data tab.
(3.) The logout service has saved sessionID mapped to it correctly.

When I add this custom component to a new page, the logout button gets added but the click event, and the logout service do not get added to this new page's "design" and the "data" tabs. When I click on this button in test, it obviously does not do anything.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

The following code is throwing out an error when I click on the button that I created from saved "Custom Component".

Below:

  • "AddEvent" is my page name.

  • The custom component (logout button) is added to this pages footer.

  • "roundLogOutButton" is the name of the custom component that I created.

  • "customCompLogOut_service" is the name of the logout service which is attached to this custom component.

  • "logout_button" is the name of the button element in the saved "roundLogOutButton" custom component.

    ----------------------------------------------------------------

    $(document).off("click", '#AddEvent_mobilefooter [name="roundLogOutButton_logout_button"]').on({
    click: function() {
    if (!$(this).attr('disabled')) {
    try {
    roundLogOutButton_customCompLogOut_service.execute({})
    } catch (ex) {
    console.log(ex.name + ' ' + ex.message);
    hideSpinner();
    };

    Code: Select all

                 } 
             }, 
         }, '#AddEvent_mobilefooter [name="roundLogOutButton_logout_button"]'); 

This code cannot find "roundLogOutButton_customCompLogOut_service"

Error in Console:


ReferenceError: roundLogOutButton_customCompLogOut_service is not defined

Is Appery failing to get hold of the service in the saved component? What is the fix for this?

Thanks,

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

Ping!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Logout custom component does not work

Post by Yurii Orishchuk »

Hi xman,

Please provide us your app public link, and describe steps to reproduce this problem.

We need to take a look.

Thanks & regards.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

Hi Yurii, I got back to this pending issue and it is still not working. I've code/error copy pasted above from debug console. This is appery code, can anyone help me understand why it's failing to find the service? Thanks.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Logout custom component does not work

Post by xman »

Some more data. The button starts to work all well, when I "Break apart as custom component" after placing the custom component. So is this the real usage information, that a custom component which as a service attached should always be broken apart after placing it on a the page where you want it?

Post Reply