1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-10-16 07:07:26 +00:00

🔧 Change users endpoint path in the frontend

This commit is contained in:
Steffo 2021-10-29 03:15:14 +02:00
parent 5bbf742fc5
commit d5c70c00ac
3 changed files with 3 additions and 3 deletions

View file

@ -44,7 +44,7 @@ export function AuthorizationLoginButton({username, password, disabled = false}:
setError(undefined)
try {
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({
type: "success:login",
user: dataRequest.data,

View file

@ -34,7 +34,7 @@ export function useCacheContext(): Cache | undefined {
* @constructor
*/
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 =
React.useMemo(

View file

@ -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 {
id: number,