Skip to content

Commit

Permalink
fix(custom moves and oracles): Fixed incorrect ID being created
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbenton committed Oct 30, 2023
1 parent bee715f commit b094d66
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/hooks/useDataswornId.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { GAME_SYSTEMS } from "types/GameSystems.type";
import { useGameSystemValue } from "./useGameSystemValue";
import { encodeContents } from "functions/dataswornIdEncoder";

export function useDataswornId() {
const systemPrefix = useGameSystemValue({
Expand All @@ -9,13 +10,17 @@ export function useDataswornId() {

return {
getId: (prefix: string, value: string) => {
return `${systemPrefix}/${prefix}/${value}`;
return `${systemPrefix}/${encodeContents(prefix)}/${encodeContents(
value
)}`;
},
getCustomIdPrefix: (prefix: string) => {
return `${systemPrefix}/${prefix}/custom`;
return `${systemPrefix}/${encodeContents(prefix)}/custom`;
},
getCustomId: (prefix: string, value: string) => {
return `${systemPrefix}/${prefix}/custom/${value}`;
return `${systemPrefix}/${encodeContents(prefix)}/custom/${encodeContents(
value
)}`;
},
};
}

0 comments on commit b094d66

Please sign in to comment.