Skip to content

Commit 98e5fd9

Browse files
Fix: UnauthorizedResult type error to generic and add undefined
1 parent a44420a commit 98e5fd9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/meteor/app/api/server/ApiClass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export class APIClass<
363363
};
364364
}
365365

366-
public unauthorized(msg?: string): UnauthorizedResult {
366+
public unauthorized<T>(msg?: T): UnauthorizedResult<T> {
367367
return {
368368
statusCode: 401,
369369
body: {

apps/meteor/app/api/server/definition.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export type RedirectResult<T, TStatusCode extends RedirectStatusCodes = 300> = {
3939
body: T;
4040
};
4141

42-
export type UnauthorizedResult = {
42+
export type UnauthorizedResult<T> = {
4343
statusCode: 401;
4444
body: {
4545
success: false;
46-
error: string;
46+
error?: T | string; // 'unauthorized' is the default error message
4747
};
4848
};
4949

0 commit comments

Comments
 (0)