mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-14 12:16:52 +00:00
20 lines
646 B
TypeScript
20 lines
646 B
TypeScript
![]() |
import { ApiStatus } from '@datahub/utils/api/shared';
|
||
|
import { setCSRFCookieToken } from '@datahub/shared/mirage-addon/helpers/csrf-protection';
|
||
|
import { HandlerFunction, Schema } from 'ember-cli-mirage';
|
||
|
|
||
|
/**
|
||
|
* Returns a config object for the config endpoint
|
||
|
* @param {object} config the config table / factory object
|
||
|
* @return {{status: ApiStatus, config: object}}
|
||
|
*/
|
||
|
export const getConfig: HandlerFunction = function(schema: Schema) {
|
||
|
// Set the cookie for csrf protection
|
||
|
setCSRFCookieToken();
|
||
|
const configs = schema.applicationCfgs || {};
|
||
|
|
||
|
return {
|
||
|
status: ApiStatus.OK,
|
||
|
config: this.serialize(configs.first())
|
||
|
};
|
||
|
};
|