Skip to content

Commit

Permalink
fix(web): refresh token before package upload
Browse files Browse the repository at this point in the history
Together with increasing token lifetime helps to mitigate anydistro#142
  • Loading branch information
LordTermor committed Sep 16, 2024
1 parent d915a4a commit b592fcb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/src/hooks/BxtHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ export const usePushCommitsHandler = (
return;
}
try {
// We can't allow requests without a valid token since the backend
// processes all files before responding. An invalid token would
// cause a full package upload resulting in an error and requiring
// the entire process to be repeated.
await axios.get("/api/auth/refresh");

const result = await axios.post(`/api/packages/commit`, form, {
onUploadProgress: (p) => {
const progress = p.loaded / (p.total || 1);
Expand Down

0 comments on commit b592fcb

Please sign in to comment.