Skip to content

Commit

Permalink
Fix auth redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym committed Nov 5, 2023
1 parent 74e272c commit 5b19986
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/dashboard-v2/src/boot/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default boot(async () => {

if (authResp === false) { // No auth token stored, try to fetch without auth or redirect
const mainStore = useMainStore()
await mainStore.loadServerConfigs()
await mainStore.loadServerConfigs(true)
}
});
6 changes: 2 additions & 4 deletions packages/dashboard-v2/src/stores/main-store.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { defineStore } from 'pinia';
import { api } from "boot/axios";
import router from "src/router";

export const useMainStore = defineStore('main', {
state: () => ({
Expand All @@ -26,7 +25,6 @@ export const useMainStore = defineStore('main', {
}
})

console.log(response.data.config)
this.configurations = response.data.config;

} catch (error) {
Expand All @@ -41,8 +39,8 @@ export const useMainStore = defineStore('main', {
if (handleError) {
// console.log(error)
if (error.response?.status === 401) {
router.push({ name: 'login' })
} else if (error.response.status === 302) {
await this.router.push({ name: 'login' })
return
}

} else {
Expand Down
2 changes: 1 addition & 1 deletion worker/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default R2Explorer({
readonly: false,
cors: true,
showHiddenFiles: true,
dashboardUrl: "https://dev.r2-explorer-dashboard.pages.dev/",
dashboardUrl: "https://dashboard-v2.r2-explorer-dashboard.pages.dev/",
basicAuth: [{
username: 'teste',
password: 'abc'
Expand Down

0 comments on commit 5b19986

Please sign in to comment.