mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 06:44:21 +00:00
🔧 Change users endpoint path in the frontend
This commit is contained in:
parent
5bbf742fc5
commit
d5c70c00ac
3 changed files with 3 additions and 3 deletions
|
@ -44,7 +44,7 @@ export function AuthorizationLoginButton({username, password, disabled = false}:
|
||||||
setError(undefined)
|
setError(undefined)
|
||||||
try {
|
try {
|
||||||
const loginRequest = await axios.post<SophonToken>("/api/auth/token/", {username, password})
|
const loginRequest = await axios.post<SophonToken>("/api/auth/token/", {username, password})
|
||||||
const dataRequest = await axios.get<SophonUser>(`/api/core/users/${username}/`)
|
const dataRequest = await axios.get<SophonUser>(`/api/core/users-by-username/${username}/`)
|
||||||
authorization.dispatch({
|
authorization.dispatch({
|
||||||
type: "success:login",
|
type: "success:login",
|
||||||
user: dataRequest.data,
|
user: dataRequest.data,
|
||||||
|
|
|
@ -34,7 +34,7 @@ export function useCacheContext(): Cache | undefined {
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export function CacheProvider({children}: WithChildren): JSX.Element {
|
export function CacheProvider({children}: WithChildren): JSX.Element {
|
||||||
const users = useManagedViewSet<SophonUser>("/api/core/users/", "id")
|
const users = useManagedViewSet<SophonUser>("/api/core/users-by-id/", "id")
|
||||||
|
|
||||||
const usersIdMap =
|
const usersIdMap =
|
||||||
React.useMemo(
|
React.useMemo(
|
||||||
|
|
|
@ -10,7 +10,7 @@ export interface SophonToken extends DjangoResource {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Django User, as returned by the `/api/core/users/` endpoint.
|
* A Django User, as returned by the `/api/core/users-by-id/` and `/api/core/users-by-username/` endpoints.
|
||||||
*/
|
*/
|
||||||
export interface SophonUser extends DjangoResource {
|
export interface SophonUser extends DjangoResource {
|
||||||
id: number,
|
id: number,
|
||||||
|
|
Loading…
Reference in a new issue