Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FaceEvent.TAG_CREATED #1

Open
og2t opened this issue Oct 12, 2010 · 0 comments
Open

FaceEvent.TAG_CREATED #1

og2t opened this issue Oct 12, 2010 · 0 comments

Comments

@og2t
Copy link

og2t commented Oct 12, 2010

Hey Jean!

I was playing with your API and it's great. There's a few bugs I've noticed tough:

faceApi.tagsService.save( tid , "franck_ribery@nstuto" );

Calling this method should dispatch FaceEvent.TAG_SAVED or similar, rather than FaceEvent.SUCCESS as the response content is different.

Also the event should handle XML request as well, it triggers error at the moment.
I just did a quick hack to handle different response types and formats:

private function loaderCompleteHandler( evt : Event ) : void
{
    var result:*;

    if (evt.target.data.indexOf('<?xml version="1.0" encoding="utf-8"?>') == -1)
    {
        result = JSON.decode( evt.target.data );
    } else {
        result = new XML( evt.target.data );
    }

    if (evt.target.data.indexOf('saved_tags') == -1)
    {
        dispatchEvent( new FaceEvent( FaceEvent.SUCCESS , result , evt.target.data , new FaceResult( result ) ));
    } else {
        dispatchEvent( new FaceEvent( FaceEvent.TAG_SAVED , result , evt.target.data , new FaceResult( result ) ));
    }

}

Perhaps you might want to solve it another way, or group responses by type?

Cheers,
Tomek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant