ntk-cms-api 20.25.12 → 20.25.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -34
- package/fesm2022/ntk-cms-api.mjs.map +1 -1
- package/index.d.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -154,35 +154,6 @@ interface BlogModel {
|
|
|
154
154
|
|
|
155
155
|
### Token Management
|
|
156
156
|
|
|
157
|
-
```typescript
|
|
158
|
-
import { TokenService } from "ntk-cms-api";
|
|
159
|
-
|
|
160
|
-
export class AuthService {
|
|
161
|
-
constructor(private tokenService: TokenService) {}
|
|
162
|
-
|
|
163
|
-
async login(username: string, password: string): Promise<boolean> {
|
|
164
|
-
try {
|
|
165
|
-
const result = await this.tokenService.ServiceAccessToken(username, password).toPromise();
|
|
166
|
-
if (result.isSuccess) {
|
|
167
|
-
localStorage.setItem("token", result.token);
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
return false;
|
|
171
|
-
} catch (error) {
|
|
172
|
-
console.error("Login error:", error);
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
logout(): void {
|
|
178
|
-
localStorage.removeItem("token");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
isAuthenticated(): boolean {
|
|
182
|
-
return !!localStorage.getItem("token");
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
157
|
|
|
187
158
|
## 📁 File Management
|
|
188
159
|
|
|
@@ -330,11 +301,7 @@ export class GlobalErrorHandler {
|
|
|
330
301
|
}
|
|
331
302
|
}
|
|
332
303
|
|
|
333
|
-
|
|
334
|
-
// Redirect to login or refresh token
|
|
335
|
-
localStorage.removeItem("token");
|
|
336
|
-
// Redirect to login page
|
|
337
|
-
}
|
|
304
|
+
|
|
338
305
|
|
|
339
306
|
private handleForbidden(): void {
|
|
340
307
|
// Handle forbidden access
|