Initial open source release

This commit is contained in:
Ronni Skansing
2025-08-21 16:14:09 +02:00
commit 11cf01f08e
488 changed files with 97180 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
// handle not ok typical responses such as unauthenticated, renew password and such
import { goto } from '$app/navigation';
/**
* @param {import("./client").ApiResponse} apiResponse
* @returns {import("./client").ApiResponse} apiResponse
**/
export const immediateResponseHandler = (apiResponse) => {
// Unauthenticated move the user to the login page
if (apiResponse.statusCode === 401) {
goto('/login');
window.location.reload();
}
// If the user must renew their password, move them to the renew password page
if (apiResponse.statusCode === 400 && apiResponse.error === 'New password required') {
goto('/login/reset-password');
return;
}
return apiResponse;
};