import { LABEL } from '../constants' ; declare var pixiv ; declare var globalInitData ; export const createGlobalData = ( ) : Pixiv . GlobalData => { let token = '' ; let userId = '' ; if ( typeof pixiv !== 'undefined' ) { token = pixiv . context . token ; userId = pixiv . user . id ; } else if ( typeof globalInitData !== 'undefined' ) { token = globalInitData . token ; userId = globalInitData . userData . id ; } if ( ! token || ! userId ) console . error ( `${ LABEL } Unauthorized: can not get a token or user id` ) ; return { token , userId } ; } ;