diff --git a/src/components/GameWindow.vue b/src/components/GameWindow.vue
index 54c8ac2..f1265e5 100644
--- a/src/components/GameWindow.vue
+++ b/src/components/GameWindow.vue
@@ -1,12 +1,13 @@
diff --git a/src/components/UnauthorizedError.ts b/src/components/UnauthorizedError.ts
new file mode 100644
index 0000000..9ec9bcb
--- /dev/null
+++ b/src/components/UnauthorizedError.ts
@@ -0,0 +1,9 @@
+export class UnauthorizedError extends Error {
+ constructor(message: string = 'Пользователь не авторизован (401)') {
+ super(message)
+ this.name = 'UnauthorizedError'
+
+ // Восстанавливаем цепочку прототипов (нужно для корректной работы instanceof в TS)
+ Object.setPrototypeOf(this, UnauthorizedError.prototype)
+ }
+}
diff --git a/src/components/client.ts b/src/components/client.ts
new file mode 100644
index 0000000..4f76bae
--- /dev/null
+++ b/src/components/client.ts
@@ -0,0 +1,37 @@
+import type { Team } from './models'
+import { UnauthorizedError } from './UnauthorizedError'
+
+export const apiGetTeam = async (login: string, password: string): Promise => {
+ try {
+ const response = await fetch(getApiUrl('/team'), {
+ method: 'GET',
+ headers: {
+ 'X-Id': encodeUTF8ToBase64(login),
+ 'X-Password': password,
+ },
+ })
+ if (response.status === 401) {
+ throw new UnauthorizedError('Ошибка авторизации')
+ }
+ if (!response.ok) {
+ throw new Error(`http error status: ${response.status}`)
+ }
+ return await response.json()
+ } catch (error) {
+ console.error('[apiGetTeam] error:', error)
+ throw error
+ }
+}
+
+export function getApiUrl(path: string) {
+ const url = 'http://' + window.location.host.split(':')[0] + ':8090' + path
+ return url
+}
+
+export function encodeUTF8ToBase64(s: string) {
+ return btoa(
+ encodeURIComponent(s).replace(/%([0-9A-F]{2})/g, (_, p1) =>
+ String.fromCharCode(parseInt(p1, 16)),
+ ),
+ )
+}
diff --git a/src/components/utils.ts b/src/components/utils.ts
deleted file mode 100644
index 1e15a6a..0000000
--- a/src/components/utils.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export function getApiUrl(path: string) {
- const url = "http://" + window.location.host.split(":")[0] + ":8090" + path
- return url
-}
-
-export function encodeUTF8ToBase64(s: string) {
- return btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16))))
-}