-
Notifications
You must be signed in to change notification settings - Fork 32
Fix clean metadata #1235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix clean metadata #1235
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { User } from "../../slices/userSlice"; | ||
import { TableConfig } from "./aclsTableConfig"; | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { PayloadAction, SerializedError, createSlice } from '@reduxjs/toolkit' | ||
import axios from 'axios'; | ||
import axios, { AxiosError } from 'axios'; | ||
import { addNotification } from './notificationSlice'; | ||
import { createAppAsyncThunk } from '../createAsyncThunkWithTypes'; | ||
|
||
|
@@ -73,26 +73,31 @@ const initialState: UserInfoState = { | |
}, | ||
}; | ||
|
||
export const fetchUserInfo = createAppAsyncThunk('UserInfo/fetchUserInfo', async (_, { dispatch }) => { | ||
// Just make the async request here, and return the response. | ||
// This will automatically dispatch a `pending` action first, | ||
// and then `fulfilled` or `rejected` actions based on the promise. | ||
const res = await axios.get("/info/me.json") | ||
.then((response) => { | ||
return response.data; | ||
}) | ||
.catch((response) => { | ||
console.error(response); | ||
dispatch(addNotification({type: "error", key: "USER_NOT_SAVED"})); | ||
}); | ||
|
||
// Redirect to login if not in ROLE_ADMIN_UI | ||
if (!(res.roles.includes('ROLE_ADMIN') || res.roles.includes('ROLE_ADMIN_UI'))) { | ||
window.location.href = "/login.html"; | ||
export const fetchUserInfo = createAppAsyncThunk( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All changes in this file seem unrelated to the issue you are trying to fix. If you still feel like they belong in the codebase, please explain why they belong in this PR or submit them as another PR and state your intentions there, |
||
'UserInfo/fetchUserInfo', | ||
async (_, { dispatch }) => { | ||
try { | ||
const response = await axios.get("/info/me.json"); | ||
const res = response.data; | ||
if (!res || !(res.roles?.includes('ROLE_ADMIN') || res.roles?.includes('ROLE_ADMIN_UI'))) { | ||
window.location.href = "/login.html"; | ||
} | ||
return res; | ||
} catch (err: unknown) { | ||
const error = err as AxiosError; | ||
// eslint-disable-next-line no-trailing-spaces | ||
console.error(error); | ||
const status = error?.response?.status; | ||
if (status === 401 || status === 403) { | ||
window.location.href = "/login.html"; | ||
// eslint-disable-next-line no-trailing-spaces | ||
} | ||
dispatch(addNotification({ type: "error", key: "USER_NOT_SAVED" })); | ||
throw error; | ||
} | ||
} | ||
|
||
return res; | ||
}); | ||
// eslint-disable-next-line no-trailing-spaces | ||
); | ||
|
||
export const fetchOcVersion = createAppAsyncThunk('UserInfo/fetchOcVersion', async () => { | ||
const res = await axios.get("/sysinfo/bundles/version?prefix=opencast"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ export const fetchUsers = createAppAsyncThunk('users/fetchUsers', async (_, { ge | |
// This will automatically dispatch a `pending` action first, | ||
// and then `fulfilled` or `rejected` actions based on the promise. | ||
const res = await axios.get("/admin-ng/users/users.json", { params: params }); | ||
console.log("this is the response", res); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Superfluous logging statement. |
||
return res.data; | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead import