auth fix
CI/CD - ERP Distribution / Build & Deploy Backend (pull_request) Failing after 13m10s
CI/CD - ERP Distribution / Build & Deploy Frontend (pull_request) Failing after 16m51s

This commit is contained in:
Kalana B. Thilakarathna
2026-10-19 10:19:40 +05:30
parent f44cbf711b
commit da29492798
+3 -2
View File
@@ -80,8 +80,9 @@ export function AuthProvider({ children }: { children: ReactNode }) {
}, [router])
async function login(identifier: string, password: string) {
const { data: loginData } = await api.post<{ profile: User }>('/auth/login', { identifier, password, deviceName: 'Web' })
setUser(loginData.profile)
const { data: res } = await api.post<{ statusCode: number; success: boolean; message: string; data: { profile: User } | null }>('/auth/login', { identifier, password, deviceName: 'Web' })
if (!res.data) throw new Error(res.message ?? 'Invalid credentials')
setUser(res.data.profile)
try {
const { data: permData } = await api.get<{ permissions: string[] }>('/authorization/my-permissions')
savePermissions(permData.permissions)