chore(check): Add option to use queries

This commit is contained in:
janishutz committed 2026-09-28 11:30:00 +02:00
1 parent 1915ba5628
commit 349e37f4a9
1 file changed
+3 -2
+3 -2
View File
@@ -27,13 +27,14 @@ export const loginInNewTab = () => {
/** /**
* Check if a user is authenticated. This can also be done implicitly using a call to a protected endpoint * Check if a user is authenticated. This can also be done implicitly using a call to a protected endpoint
* @param query Query string, without the leading question mark. E.g. `test=true&force=false`
* @returns A promise resolving to a boolean indicating authentication status * @returns A promise resolving to a boolean indicating authentication status
*/ */
export const check = async (): Promise<boolean> => { export const check = async ( query?: string ): Promise<boolean> => {
let status: boolean; let status: boolean;
try { try {
status = ( await request.get( config.get().authCheckEndpoint ?? '/auth/v2/check' ) ).ok; status = ( await request.get( config.get().authCheckEndpoint ?? '/auth/v2/check' + ( query ? '?' + query : '' ) ) ).ok;
} catch ( e ) { } catch ( e ) {
if ( e instanceof AuthError ) { if ( e instanceof AuthError ) {
status = false; status = false;