mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
## About the changes
Ref:
https://docs.getunleash.io/reference/deploy/configuring-unleash#further-customization
> **eventHook** (`function(event, data)`) - (_deprecated in Unleash 4.3_
in favor of the [Webhook addon](../addons/webhook.md)) If provided, this
function will be invoked whenever a feature is mutated. The possible
values for `event` are `'feature-created'`, `'feature-archived'` and
`'feature-revived'`. The `data` argument contains information about the
mutation. Its fields are `type` (string) - the event type (same as
`event`); `createdBy` (string) - the user who performed the mutation;
`data` - the contents of the change. The contents in `data` differs
based on the event type; For `'feature-archived'` and
`'feature-revived'`, the only field will be `name` - the name of the
feature. For `'feature-created'` the data follows a schema defined in
the code
[here](7b7f0b84e8/src/lib/schema/feature-schema.ts (L77)
).
See an [api here](/reference/api/legacy/unleash/admin/events).
Related to: https://github.com/Unleash/unleash/issues/1265
20 lines
474 B
TypeScript
20 lines
474 B
TypeScript
export const formatBaseUri = (input?: string): string => {
|
|
if (!input) return '';
|
|
const firstChar = input[0];
|
|
const lastChar = input[input.length - 1];
|
|
|
|
if (firstChar === '/' && lastChar === '/') {
|
|
return input.substring(0, input.length - 1);
|
|
}
|
|
|
|
if (firstChar !== '/' && lastChar === '/') {
|
|
return `/${input.substring(0, input.length - 1)}`;
|
|
}
|
|
|
|
if (firstChar !== '/') {
|
|
return `/${input}`;
|
|
}
|
|
|
|
return input;
|
|
};
|