import { TOKEN_KEY, USER_KEY, WATCH_SHARED_DATA_KEY } from '@/modules/@common/watch/constants';

import { UserType } from '@/modules/@common/user/types';

export const setInternalWatchData = ({ token, user }: { token: string; user: UserType }) => `
    window.${WATCH_SHARED_DATA_KEY} = {
      ${TOKEN_KEY}: '${token}',
      ${USER_KEY}: ${JSON.stringify(user)
        .replace(/</g, '\\u003c')
        .replace(/>/g, '\\u003e')
        .replace(/\u2028/g, '\\u2028')
        .replace(/\u2029/g, '\\u2029')}
    }
  `;

export default {};
