Skip to main content
Sign in
Snippets Groups Projects
Commit 5ae96771 authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Don't fail when user is not authenticated, and public budgets are missing

parent 170ff4d7
No related branches found
No related tags found
No related merge requests found
Pipeline #10750 passed
...@@ -68,14 +68,23 @@ export const POST: RequestHandler = async ({ fetch, locals, request }) => { ...@@ -68,14 +68,23 @@ export const POST: RequestHandler = async ({ fetch, locals, request }) => {
result: (await fs.readJson(cachePath)).budgetSimulation, result: (await fs.readJson(cachePath)).budgetSimulation,
hash: cacheDigest, hash: cacheDigest,
isPublic: isSimulationPublic, isPublic: isSimulationPublic,
} as BudgetSimulation) })
} else if (user === undefined && (await fs.pathExists(baseCachePath))) { } else if (user === undefined) {
if (await fs.pathExists(baseCachePath)) {
return json({ return json({
errors: [], errors: [],
result: (await fs.readJson(baseCachePath)).budgetSimulation, result: (await fs.readJson(baseCachePath)).budgetSimulation,
hash: cacheDigest, hash: cacheDigest,
isPublic: true, isPublic: true,
} as BudgetSimulation) })
} else {
return json({
errors: ["Utilisateur anonyme et calcul budgétaire non pré-calculé"],
// result: undefined,
hash: cacheDigest,
isPublic: true,
})
}
} }
const payload = { const payload = {
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment