Skip to content

Commit 14ceb34

Browse files
authored
[Human App Frontend] Remove 'Operator' part and other unused pieces (#3997)
1 parent c01335c commit 14ceb34

167 files changed

Lines changed: 212 additions & 4063 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/apps/human-app/frontend/src/api/auth-service.ts‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,16 @@ import {
77
} from '@/shared/schemas';
88
import { type BrowserAuthProvider } from '@/shared/types/browser-auth-provider';
99
import { type HttpApiClient } from './http-api-client';
10-
import { commonApiPaths } from './common-api-paths';
1110

1211
export interface AuthProvider {
1312
getAccessToken: () => Promise<string | null>;
1413
refreshAccessToken: () => Promise<void>;
1514
}
1615

1716
const apiPaths = {
18-
worker: {
19-
signIn: {
20-
path: '/auth/signin',
21-
},
22-
},
23-
} as const;
17+
signIn: '/auth/signin',
18+
refresh: '/auth/refresh',
19+
};
2420

2521
export class AuthService implements AuthProvider {
2622
private readonly browserAuthProvider: BrowserAuthProvider =
@@ -33,7 +29,7 @@ export class AuthService implements AuthProvider {
3329

3430
async signIn(data: SignInDto): Promise<AuthTokensSuccessResponse> {
3531
const res = await this.httpClient.post<AuthTokensSuccessResponse>(
36-
apiPaths.worker.signIn.path,
32+
apiPaths.signIn,
3733
{
3834
successSchema: authTokensSuccessResponseSchema,
3935
body: data,
@@ -70,12 +66,6 @@ export class AuthService implements AuthProvider {
7066
}
7167

7268
async refreshAccessToken(): Promise<void> {
73-
const authType = this.browserAuthProvider.getAuthType();
74-
75-
if (!authType) {
76-
throw new Error('Auth type not found');
77-
}
78-
7969
if (!AuthService.refreshPromise) {
8070
AuthService.refreshPromise = this.fetchTokenRefresh();
8171
}
@@ -88,7 +78,7 @@ export class AuthService implements AuthProvider {
8878
throw new Error('Failed to refresh access token');
8979
}
9080

91-
browserAuthProvider.signIn(tokens, authType);
81+
browserAuthProvider.signIn(tokens);
9282
}
9383

9484
private async fetchTokenRefresh(): Promise<AuthTokensSuccessResponse | null> {
@@ -100,7 +90,7 @@ export class AuthService implements AuthProvider {
10090

10191
try {
10292
const response = await this.httpClient.post<AuthTokensSuccessResponse>(
103-
commonApiPaths.auth.refresh.path,
93+
apiPaths.refresh,
10494
{
10595
body: {
10696
refresh_token: refreshToken,

‎packages/apps/human-app/frontend/src/api/common-api-paths.ts‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎packages/apps/human-app/frontend/src/api/hooks/use-access-token-refresh.ts‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,28 @@ import { useMutation } from '@tanstack/react-query';
22
import { useNavigate } from 'react-router-dom';
33
import { useAuth } from '@/modules/auth/hooks/use-auth';
44
import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider';
5-
import type { AuthType } from '@/shared/types/browser-auth-provider';
6-
import { useWeb3Auth } from '@/modules/auth-web3/hooks/use-web3-auth';
75
import { routerPaths } from '@/router/router-paths';
86
import { authService } from '../authorized-http-api-client';
97

8+
type RefreshAccessTokenParams = {
9+
throwExpirationModalOnSignOut?: boolean;
10+
};
11+
1012
export function useAccessTokenRefresh() {
1113
const navigate = useNavigate();
12-
const { signOut: web2SignOut, user: web2User } = useAuth();
13-
14-
const { signOut: web3SignOut, user: web3User } = useWeb3Auth();
14+
const { user, signOut } = useAuth();
1515

1616
const mutation = useMutation({
17-
mutationFn: async ({
18-
authType,
19-
throwExpirationModalOnSignOut = true,
20-
}: {
21-
authType: AuthType;
22-
throwExpirationModalOnSignOut?: boolean;
23-
}) => {
17+
mutationFn: async (params?: RefreshAccessTokenParams) => {
18+
const throwExpirationModalOnSignOut =
19+
params?.throwExpirationModalOnSignOut ?? true;
20+
2421
try {
2522
await authService.refreshAccessToken();
2623
} catch (error) {
2724
console.error(error);
28-
if (authType === 'web2' && web2User) {
29-
web2SignOut({ throwExpirationModal: false });
30-
}
31-
if (authType === 'web3' && web3User) {
32-
web3SignOut({ throwExpirationModal: false });
25+
if (user) {
26+
signOut({ throwExpirationModal: false });
3327
}
3428
browserAuthProvider.signOut({
3529
triggerSignOutSubscriptions: throwExpirationModalOnSignOut,
@@ -45,8 +39,16 @@ export function useAccessTokenRefresh() {
4539
});
4640

4741
return {
48-
refreshAccessToken: mutation.mutate,
49-
refreshAccessTokenAsync: mutation.mutateAsync,
42+
refreshAccessToken: (
43+
params?: RefreshAccessTokenParams,
44+
options?: Parameters<typeof mutation.mutate>[1]
45+
) => {
46+
mutation.mutate(params, options);
47+
},
48+
refreshAccessTokenAsync: (
49+
params?: RefreshAccessTokenParams,
50+
options?: Parameters<typeof mutation.mutateAsync>[1]
51+
) => mutation.mutateAsync(params, options),
5052
isRefreshingAccessToken: mutation.isPending,
5153
};
5254
}

‎packages/apps/human-app/frontend/src/assets/icons-dark-mode/delete-icon.svg‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/apps/human-app/frontend/src/assets/icons-dark-mode/edit-icon.svg‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/apps/human-app/frontend/src/assets/icons-dark-mode/filters-button-icon.svg‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/apps/human-app/frontend/src/assets/icons-dark-mode/filters-icon.svg‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/apps/human-app/frontend/src/assets/icons-dark-mode/icons-human-logo/human-logo.svg‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/apps/human-app/frontend/src/assets/icons-dark-mode/locker-icon.svg‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎packages/apps/human-app/frontend/src/assets/icons-dark-mode/sort-arrow.svg‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)