Typo on libraries.source.handlers documentation

Hi all,
Not sure if this is a typo but it looks like it may be. On this page:
https://api.frontity.org/frontity-packages/features-packages/wp-source#libraries

In the example code:

// A handler example to retrieve products
libraries.source.handlers.push({
  name: "product",
  priority: 10,
  pattern: "/product/:slug",
  func: async ({ link, params, state, libraries, force }) => {
    // 1. get product
    const response = await libraries.source.api.get({
      endpoint: "products",
      params: { slug: params.slug },
    });

    // 2. add product to state
    const [product] = await libraries.source.populate({
      response,
      state,
      force,
    });

    // 3. add link to data
    Object.assign(state.source.datalink, {
      id: product.id,
      type: product.type,
      isPostType: true,
      isProduct: true,
    });
  },
});

In step 3, I believe it should be:
Object.assign(state.source.data[link], { ...
instead of
Object.assign(state.source.datalink, { ...

Thanks!

1 Like

You’re absolutely right. It was a typo

Already fixed :+1:

https://api.frontity.org/frontity-packages/features-packages/wp-source#libraries-source-handlers

Thanks a lot @sattley!

1 Like