generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,10 @@ | ||
import type { UserInfo } from '@/types/types' | ||
import config from '../config' | ||
import * as api from './api' | ||
|
||
export async function getUsers(): Promise<any[]> { | ||
export async function getUsers(): Promise<UserInfo[]> { | ||
const adminDataUrl: string = `${config.API_BASE_URL}/admin` | ||
console.log(adminDataUrl) | ||
const getParameters = api.generateApiParameters(adminDataUrl) | ||
const adminData: any[] = await api.get(getParameters) | ||
const adminData: UserInfo[] = await api.get(getParameters) | ||
return adminData | ||
} | ||
|
||
// export const findIdirUser = async ( | ||
// email: string, | ||
// ): Promise<{ foundUserObject: any | null; error: string | null }> => { | ||
// const url = `${config.API_BASE_URL}/admin/search-users` | ||
// const data = { email } | ||
// const postParameters = api.generateApiParameters(url, data) | ||
// const response: { userObject: any | null; error: string | null } = | ||
// await api.post(postParameters) | ||
// return { | ||
// foundUserObject: response.userObject || null, | ||
// error: response.error || null, | ||
// } | ||
// } | ||
|
||
// export const addAdmin = async ( | ||
// idirUsername: string, | ||
// ): Promise<{ userObject: any; error: string }> => { | ||
// const url = `${config.API_BASE_URL}/admin/add-admin` | ||
// const data = { idirUsername } | ||
// const postParameters = api.generateApiParameters(url, data) | ||
// const response: { userObject: any; error: string } = | ||
// await api.post(postParameters) | ||
// return response | ||
// } | ||
|
||
// export const removeAdmin = async ( | ||
// idirUsername: string, | ||
// ): Promise<{ error: string | null }> => { | ||
// const url = `${config.API_BASE_URL}/admin/remove-admin` | ||
// const data = { idirUsername } | ||
// const postParameters = api.generateApiParameters(url, data) | ||
// return api.post(postParameters) | ||
// } |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
enum Roles { | ||
ENMODS_USER = 'Enmods user', | ||
ENMODS_ADMIN = "Enmods admin", | ||
ENMODS_USER = 'Enmods User', | ||
ENMODS_ADMIN = 'Enmods Admin', | ||
} | ||
|
||
export default Roles; | ||
export default Roles |
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,10 @@ | ||
/** | ||
* Type returned from the frontend for displaying users on Admin page | ||
*/ | ||
export type UserInfo = { | ||
username: string | ||
email: string | ||
name: string | ||
company: string | ||
role: string[] | ||
} |