-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ #554 - feat: add frontend support for filtering destruction lists o…
…n name, status, author, reviewer and assignee
- Loading branch information
1 parent
ec9d877
commit eec7128
Showing
10 changed files
with
229 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
import { User } from "../lib/api/auth"; | ||
import { listRecordManagers } from "../lib/api/recordManagers"; | ||
import { useAlertOnError } from "./useAlertOnError"; | ||
|
||
/** | ||
* Hook resolving recordManagers | ||
*/ | ||
export function useRecordManagers(): User[] { | ||
const alertOnError = useAlertOnError( | ||
"Er is een fout opgetreden bij het ophalen van record managers!", | ||
); | ||
|
||
const [recordManagersState, setRecordManagersState] = useState<User[]>([]); | ||
useEffect(() => { | ||
listRecordManagers() | ||
.then((r) => setRecordManagersState(r)) | ||
.catch(alertOnError); | ||
}, []); | ||
|
||
return recordManagersState; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
import { User } from "../lib/api/auth"; | ||
import { listUsers } from "../lib/api/users"; | ||
import { useAlertOnError } from "./useAlertOnError"; | ||
|
||
/** | ||
* Hook resolving users | ||
*/ | ||
export function useUsers(): User[] { | ||
const alertOnError = useAlertOnError( | ||
"Er is een fout opgetreden bij het ophalen van gebruikers!", | ||
); | ||
|
||
const [usersState, setUsersState] = useState<User[]>([]); | ||
useEffect(() => { | ||
listUsers() | ||
.then((r) => setUsersState(r)) | ||
.catch(alertOnError); | ||
}, []); | ||
|
||
return usersState; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { cacheMemo } from "../cache/cache"; | ||
import { User } from "./auth"; | ||
import { request } from "./request"; | ||
|
||
/** | ||
* List all the users that have the permission to review destruction lists. | ||
*/ | ||
export async function listRecordManagers() { | ||
return cacheMemo("listRecordManagers", async () => { | ||
const response = await request("GET", "/record-managers/"); | ||
const promise: Promise<User[]> = response.json(); | ||
return promise; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { cacheMemo } from "../cache/cache"; | ||
import { User } from "./auth"; | ||
import { request } from "./request"; | ||
|
||
/** | ||
* List all the users that have the permission to review destruction lists. | ||
*/ | ||
export async function listUsers() { | ||
return cacheMemo("listUsers", async () => { | ||
const response = await request("GET", "/users/"); | ||
const promise: Promise<User[]> = response.json(); | ||
return promise; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters