initial commit (frontend)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export const getInitData = (): string => {
|
||||
if (typeof window !== 'undefined' && window.Telegram?.WebApp?.initData) {
|
||||
return window.Telegram.WebApp.initData;
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
export const getUserId = (): number | null => {
|
||||
if (typeof window !== 'undefined' && window.Telegram?.WebApp?.initDataUnsafe?.user?.id) {
|
||||
return window.Telegram.WebApp.initDataUnsafe.user.id;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export const getTelegramLang = (): string => {
|
||||
if (typeof window !== 'undefined' && window.Telegram?.WebApp?.initDataUnsafe?.user?.language_code) {
|
||||
return window.Telegram.WebApp.initDataUnsafe.user.language_code;
|
||||
}
|
||||
return "pl";
|
||||
};
|
||||
Reference in New Issue
Block a user