feat: just getting better and better
This commit is contained in:
@@ -26,7 +26,7 @@ export const useChannelsStore = defineStore('channels', () => {
|
||||
|
||||
for (const item of contentItemsStore.items) {
|
||||
for (const name of parseTargets(item.publicationTargets)) {
|
||||
const key = slugify(name);
|
||||
const key = normalizeChannelKey(name);
|
||||
const existing = derivedChannels.get(key) ?? {
|
||||
id: key,
|
||||
name,
|
||||
@@ -95,7 +95,7 @@ export const useChannelsStore = defineStore('channels', () => {
|
||||
[currentWorkspaceId]: [
|
||||
...next,
|
||||
{
|
||||
id: slugify(`${normalizedNetwork}-${normalizedName}`),
|
||||
id: normalizeChannelKey(`${normalizedNetwork}-${normalizedName}`),
|
||||
name: normalizedName,
|
||||
network: normalizedNetwork,
|
||||
},
|
||||
@@ -110,7 +110,7 @@ export const useChannelsStore = defineStore('channels', () => {
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function slugify(value) {
|
||||
function normalizeChannelKey(value) {
|
||||
return value.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user