How to Properly Utilize PATCH

Options
NWold
NWold Member

I was trying to configure PATCH to update information on a User database. I am currently using this with Draftbit.

My issue is that I am unsure how to specify that a user can only update their information both in the backend and in the front end.

How can i make this work?

Best Answer

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Answer ✓
    Options

    Hi,

    on the Xano side you can check for example with precondition that user you want to edit is the user trying to edit and throw an error otherwise. If this endoint require authentication and it seems that it should you can use user_id provided by it. You can find it in auth tab as "id", this is the id of the user who is making the request.

Answers

  • NWold
    NWold Member
    Options

    I see. Where would I go specifically to set up the error message?

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    In function stack in untility functions you have a function called precondition. You need to set the condition that need to be met to pass through that function if the condition is not met it will trow the error that you can specify.