Skip to content

Commit

Permalink
fix(widget): allow trpc request headers and set default mode id for v…
Browse files Browse the repository at this point in the history
…ariable alias (#71)
  • Loading branch information
tomasfrancisco authored Nov 6, 2024
1 parent 616d8db commit 447fc0a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/engine/src/lib/headers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const headers = async () => {
},
{
key: 'Access-Control-Allow-Headers',
value: 'Content-Type, Authorization',
value: 'Content-Type, Authorization, x-trpc-source, trpc-accept',
},
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { nonNullable } from '../utils/non-nullable';
import { extractVariable } from './extract-variable';
import { combinePaths } from '../utils/combine-paths';
import { JSONTokenTree } from 'design-tokens-format-module';
import type { JSONTokenTree } from 'design-tokens-format-module';

export const extractVariableCollection = async (
variableCollection: VariableCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ export const getModeKey = async ({
}) => {
const variableCollection = await collectionById(variableCollectionId);

return (
const modeKey = (
variableCollection?.modes.find((mode) => mode.modeId === modeId)?.name ??
modeId
variableCollection?.modes.find(
(mode) => mode.modeId === variableCollection.defaultModeId
)?.name ??
'--error--'
).toLowerCase();

return modeKey;
};

0 comments on commit 447fc0a

Please sign in to comment.