7ac30bb454
- Implemented warehouses API with methods for listing, creating, and managing bins. - Added wastage API to handle stock write-offs and integrate with stock adjustments. - Created auth token management for storing and retrieving access tokens. - Developed error mapping for consistent user-facing error messages. - Introduced client-side validations for GRN, master data, and procurement processes. - Defined common types for pagination, problem details, and various master data entities. - Established procurement and stock management types to support frontend functionality.
17 lines
641 B
TypeScript
17 lines
641 B
TypeScript
// Bearer-token storage for the ERPCore API client (docs/20-FRONTEND.md §1).
|
|
// Login (POST /auth/login) is not wired yet — reads simply return null until it is,
|
|
// and the API client omits the Authorization header in that case.
|
|
|
|
const STORAGE_KEY = "erpcore.accessToken"
|
|
|
|
export function getAccessToken(): string | null {
|
|
if (typeof window === "undefined") return null
|
|
return window.localStorage.getItem(STORAGE_KEY)
|
|
}
|
|
|
|
export function setAccessToken(token: string | null) {
|
|
if (typeof window === "undefined") return
|
|
if (token) window.localStorage.setItem(STORAGE_KEY, token)
|
|
else window.localStorage.removeItem(STORAGE_KEY)
|
|
}
|