mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 12:05:53 +00:00
refactor: remove preference-view (#8894)
* remove preference-view * bump api --------- Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
@ -15,10 +15,6 @@ import {
|
||||
} from '@tabler/icons-react';
|
||||
|
||||
import { t } from '@lingui/macro';
|
||||
import { showNotification } from '@mantine/notifications';
|
||||
import { api } from '../../App';
|
||||
import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||
import { apiUrl } from '../../states/ApiState';
|
||||
import type { Provider } from '../../states/states';
|
||||
|
||||
const brandIcons: { [key: string]: JSX.Element } = {
|
||||
@ -37,24 +33,7 @@ const brandIcons: { [key: string]: JSX.Element } = {
|
||||
|
||||
export function SsoButton({ provider }: Readonly<{ provider: Provider }>) {
|
||||
function login() {
|
||||
// set preferred provider
|
||||
api
|
||||
.put(
|
||||
apiUrl(ApiEndpoints.ui_preference),
|
||||
{ preferred_method: 'pui' },
|
||||
{ headers: { Authorization: '' } }
|
||||
)
|
||||
.then(() => {
|
||||
// redirect to login
|
||||
window.location.href = provider.login;
|
||||
})
|
||||
.catch(() => {
|
||||
showNotification({
|
||||
title: t`Error`,
|
||||
message: t`Sign in redirect failed.`,
|
||||
color: 'red'
|
||||
});
|
||||
});
|
||||
window.location.href = provider.login;
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -221,6 +221,5 @@ export enum ApiEndpoints {
|
||||
error_report_list = 'error-report/',
|
||||
project_code_list = 'project-code/',
|
||||
custom_unit_list = 'units/',
|
||||
ui_preference = 'web/ui_preference/',
|
||||
notes_image_upload = 'notes-image-upload/'
|
||||
}
|
||||
|
Reference in New Issue
Block a user