Skip to content

Commit 7918366

Browse files
committed
fixed redundant typing
1 parent 4b90a6b commit 7918366

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/common/types/iam.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,22 @@ const userOrgSchema = z.object({
7171
netid: z.string().min(1),
7272
org: z.enum(OrganizationList),
7373
});
74-
const userOrgsSchema = z.array(userOrgSchema);
74+
// const userOrgsSchema = z.array(userOrgSchema);
7575

7676
const userNameSchema = z.object({
7777
netid: z.string().min(1),
7878
firstName: z.string().min(1),
7979
middleName: z.string().optional(),
8080
lastName: z.string().min(1),
8181
});
82-
const userNamesSchema = z.array(userNameSchema);
82+
// const userNamesSchema = z.array(userNameSchema);
8383

8484
const userSchema = userNameSchema.merge(userOrgSchema);
85-
const usersSchema = z.array(userSchema);
85+
// const usersSchema = z.array(userSchema);
8686

8787
export type UserOrg = z.infer<typeof userOrgSchema>;
88-
export type UserOrgs = z.infer<typeof userOrgsSchema>;
88+
// export type UserOrgs = z.infer<typeof userOrgsSchema>;
8989
export type UserName = z.infer<typeof userNameSchema>;
90-
export type UserNames = z.infer<typeof userNamesSchema>;
90+
// export type UserNames = z.infer<typeof userNamesSchema>;
9191
export type User = z.infer<typeof userSchema>;
92-
export type Users = z.infer<typeof usersSchema>;
92+
// export type Users = z.infer<typeof usersSchema>;

src/ui/pages/screen/Screen.page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { AuthGuard } from '@ui/components/AuthGuard';
1313
import { useApi } from '@ui/util/api';
1414
import { AppRoles } from '@common/roles.js';
1515
import { OrganizationList } from '@common/orgs';
16-
import { User, UserNames, UserOrgs, Users } from '@common/types/iam';
16+
import { User, UserName, UserOrg } from '@common/types/iam';
1717

1818
// const repeatOptions = ['weekly', 'biweekly'] as const;
1919

@@ -22,7 +22,7 @@ import { User, UserNames, UserOrgs, Users } from '@common/types/iam';
2222
// export type EventsGetResponse = z.infer<typeof getEventsSchema>;
2323

2424
export const ScreenPage: React.FC = () => {
25-
const [userList, setUserList] = useState<Users>([]);
25+
const [userList, setUserList] = useState<User[]>([]);
2626
const api = useApi('core');
2727
const [opened, { open, close }] = useDisclosure(false);
2828
// const [showPrevious, { toggle: togglePrevious }] = useDisclosure(false); // Changed default to false
@@ -87,7 +87,7 @@ export const ScreenPage: React.FC = () => {
8787
// });
8888

8989
// get request for user orgs
90-
const userOrgsResponse: UserOrgs = [
90+
const userOrgsResponse: UserOrg[] = [
9191
{ netid: 'johnd01', org: 'SIGMusic' },
9292
{ netid: 'miker44', org: 'SIGPLAN' },
9393
{ netid: 'chrisb19', org: 'SIGCHI' },
@@ -118,7 +118,7 @@ export const ScreenPage: React.FC = () => {
118118
];
119119

120120
// retrieve from azure active directory (aad)
121-
const userNamesResponse: UserNames = [
121+
const userNamesResponse: UserName[] = [
122122
{ netid: 'johnd01', firstName: 'John', lastName: 'Doe' },
123123
{ netid: 'miker44', firstName: 'Michael', lastName: 'Roberts' },
124124
{ netid: 'chrisb19', firstName: 'Christopher', lastName: 'Brown' },
@@ -148,7 +148,7 @@ export const ScreenPage: React.FC = () => {
148148
{ netid: 'patrickh37', firstName: 'Patrick', middleName: 'Henry', lastName: 'Hill' },
149149
];
150150

151-
const mergedResponse: Users = userOrgsResponse.map((orgObj) => {
151+
const mergedResponse: User[] = userOrgsResponse.map((orgObj) => {
152152
const nameObj = userNamesResponse.find((name) => name.netid === orgObj.netid);
153153
return { ...orgObj, ...nameObj } as User;
154154
});

0 commit comments

Comments
 (0)