m6120
m6120

Reputation: 21

How to access pocketbase custom hooks values in sveltekit?

After inserting data into database, I want to get ID of inserted data and use it in frontend (sveltekit).

To get ID, I did this,

onRecordAfterCreateRequest((e) => {
    const post_id = e.record.getId;
}, "posts")

I don't know how to use this post_id in sveltekit.

Upvotes: 2

Views: 199

Answers (1)

This is not possible from any frontend(vanilla or framework). According with Pocketbase docs, these hooks are only for server-side, you can access to pb_hook folder inside your server via SSH and put a js file (according with Pocketbase conventions) to use or execute hooks

Upvotes: 1

Related Questions