fix error2

This commit is contained in:
2025-10-31 18:16:53 +03:30
parent 33d4edae67
commit 4b0a110371
6 changed files with 12 additions and 4 deletions

1
global.d.ts vendored
View File

@@ -1 +1,2 @@
declare module 'next-pwa';
declare module 'jalaali-js';

7
package-lock.json generated
View File

@@ -9,6 +9,7 @@
"version": "0.1.0",
"dependencies": {
"chart.js": "^4.5.0",
"jalaali-js": "^1.2.8",
"next": "15.5.4",
"next-pwa": "^5.6.0",
"react": "19.1.0",
@@ -6558,6 +6559,12 @@
"node": ">=10"
}
},
"node_modules/jalaali-js": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/jalaali-js/-/jalaali-js-1.2.8.tgz",
"integrity": "sha512-Jl/EwY84JwjW2wsWqeU4pNd22VNQ7EkjI36bDuLw31wH98WQW4fPjD0+mG7cdCK+Y8D6s9R3zLiQ3LaKu6bD8A==",
"license": "MIT"
},
"node_modules/jest-worker": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz",

View File

@@ -9,8 +9,8 @@
"lint": "eslint"
},
"dependencies": {
"jalaali-js": "^1.2.6",
"chart.js": "^4.5.0",
"jalaali-js": "^1.2.8",
"next": "15.5.4",
"next-pwa": "^5.6.0",
"react": "19.1.0",

File diff suppressed because one or more lines are too long

View File

@@ -70,7 +70,7 @@ export default function DevicesPage() {
// فراخوانی API برای بررسی دستگاه
const device = await api.CheckDevice(currentDeviceName.trim(), currentPassword.trim())
if (device) {
if (device !=undefined) {
setSelected(device)
} else {
setError('دستگاه یافت نشد یا رمز عبور نادرست است')

View File

@@ -58,7 +58,7 @@ async function http<T>(url: string, init?: RequestInit): Promise<T> {
}
export const api = {
CheckDevice: (deviceName: string, password: string) => http<boolean>(`${API_BASE}/api/devices/CheckDevice?deviceName=${deviceName}&password=${password}`),
CheckDevice: (deviceName: string, password: string) => http<DeviceDto>(`${API_BASE}/api/devices/CheckDevice?deviceName=${deviceName}&password=${password}`),
listDevices: () => http<DeviceDto[]>(`${API_BASE}/api/devices`),
createDevice: (dto: DeviceDto) => http<number>(`${API_BASE}/api/devices`, { method: 'POST', body: JSON.stringify(dto) }),
listTelemetry: (q: { deviceId?: number; startUtc?: string; endUtc?: string; page?: number; pageSize?: number }) => {