260723_01_ENH: 설문 URL 치환시 모든 헤더 정보에 대해서 치환 가능하게 수정
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// project.surveyUrl에 들어있는 [$SID] 치환 토큰을 실제 sid로 바꾼다.
|
||||
// project.surveyUrl에 들어있는 [$SID], [$헤더명] 치환 토큰을 values에 있는 값으로 바꾼다.
|
||||
// 값이 없는 토큰은 빈 문자열로 치환한다(URL에 인코딩되지 않은 대괄호가 남지 않도록).
|
||||
// 참고: src/app/(pages)/(main)/project/info/page.tsx의 sidParam = 'sid=[$SID]'와 동일한 토큰.
|
||||
export const substituteSurveyUrl = (surveyUrl: string, sid: string) => surveyUrl.replaceAll("[$SID]", sid);
|
||||
export const substituteSurveyUrl = (surveyUrl: string, values: Record<string, string>) =>
|
||||
surveyUrl.replace(/\[\$([^\]]+)\]/g, (_, key: string) => values[key] ?? "");
|
||||
|
||||
Reference in New Issue
Block a user