UNPKG

strapi-plugin-prev-next-button

Version:
21 lines (20 loc) 799 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const isNumber_1 = __importDefault(require("lodash/isNumber")); const pluginId = require('../pluginId'); exports.default = ({ strapi }) => ({ async items(ctx) { if (!ctx.params.uid || !(0, isNumber_1.default)(Number(ctx.params.id))) { ctx.throw(400, 'uid and id are required'); } const prevNextItems = await strapi .plugin(pluginId) .service('prevNextItems') .getPrevNextItems(ctx.params.uid, ctx.params.id); ctx.type = 'application/json; charset=utf-8'; ctx.send(prevNextItems); }, });