c6dd21f4dd
This commit uses all our new ways of doing things to Lock Sessions and their interactions with KV and Nodes. This is mostly around are new under-the-hood things, but also I took the opportunity to upgrade some of the CSS to reuse some of our CSS utils that have been made over the past few months (%csv-list and %horizontal-kv-list). Also added (and worked on existing) documentation for Lock Session related components.
28 lines
668 B
JavaScript
28 lines
668 B
JavaScript
import Serializer from './application';
|
|
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/session';
|
|
|
|
export default class SessionSerializer extends Serializer {
|
|
primaryKey = PRIMARY_KEY;
|
|
slugKey = SLUG_KEY;
|
|
|
|
respondForQueryRecord(respond, query) {
|
|
return super.respondForQueryRecord(
|
|
cb =>
|
|
respond((headers, body) => {
|
|
if (body.length === 0) {
|
|
const e = new Error();
|
|
e.errors = [
|
|
{
|
|
status: '404',
|
|
title: 'Not found',
|
|
},
|
|
];
|
|
throw e;
|
|
}
|
|
return cb(headers, body[0]);
|
|
}),
|
|
query
|
|
);
|
|
}
|
|
}
|