diff --git a/src/entities/user/model/types.ts b/src/entities/user/model/types.ts index 97b05a8..b0f08bc 100644 --- a/src/entities/user/model/types.ts +++ b/src/entities/user/model/types.ts @@ -8,13 +8,13 @@ export interface MenuGrantsItem { grant: number; }; export interface LoginResponse { + usrid?: string; tokenType?: string; accessToken?: string; refreshToken?: string; accessTokenExpiresIn?: number; refreshTokenExpiresIn?: number; menuGrants?: Array; - // usrid?: string; clientAddressIP?: string; tempToken?: string, tempTokenExpiresIn?: number; diff --git a/src/hooks/useAppBridge.tsx b/src/hooks/useAppBridge.tsx index 68097de..159ad0b 100644 --- a/src/hooks/useAppBridge.tsx +++ b/src/hooks/useAppBridge.tsx @@ -38,6 +38,12 @@ interface UseAppBridgeReturn { // 공유 shareContent: (content: ShareContent) => Promise; + // 로그아웃 + logout: () => Promise; + + // 토큰 요청 + requestToken: () => Promise; + // 간편 인증 등록 registerBiometric: () => Promise; @@ -157,6 +163,20 @@ export const useAppBridge = (): UseAppBridgeReturn => { return appBridge.safeCall(() => appBridge.removeStorage(key)); }, [isNativeEnvironment]); + const logout = useCallback(async (): Promise => { + if (!isNativeEnvironment) { + throw new Error('Logout is only available in native environment'); + } + return appBridge.safeCall(() => appBridge.logout()); + }, [isNativeEnvironment]); + + const requestToken = useCallback(async (): Promise => { + if (!isNativeEnvironment) { + throw new Error('Token request is only available in native environment'); + } + return appBridge.safeCall(() => appBridge.requestToken()); + }, [isNativeEnvironment]); + const registerBiometric = useCallback(async (): Promise => { if (!isNativeEnvironment) { throw new Error('Biometric auth is only available in native environment'); @@ -296,6 +316,8 @@ export const useAppBridge = (): UseAppBridgeReturn => { getContacts, */ shareContent, + logout, + requestToken, registerBiometric, openBiometricRegistrationPopup, closeBiometricRegistrationPopup diff --git a/src/types/bridge.ts b/src/types/bridge.ts index 390029d..32fedd5 100644 --- a/src/types/bridge.ts +++ b/src/types/bridge.ts @@ -34,6 +34,9 @@ export enum BridgeMessageType { SET_STORAGE = 'setStorage', GET_STORAGE = 'getStorage', REMOVE_STORAGE = 'removeStorage', + + // 토큰 요청 + REQUEST_TOKEN = 'requestToken', // 카메라/갤러리 OPEN_CAMERA = 'openCamera', diff --git a/src/utils/appBridge.ts b/src/utils/appBridge.ts index 04cbaeb..ced2e42 100644 --- a/src/utils/appBridge.ts +++ b/src/utils/appBridge.ts @@ -153,6 +153,10 @@ class AppBridge { return this.sendMessage(BridgeMessageType.REMOVE_STORAGE, { key }); } + async requestToken(): Promise { + return this.sendMessage(BridgeMessageType.REQUEST_TOKEN); + } + // 공유 관련 async shareContent(content: ShareContent): Promise { return this.sendMessage(BridgeMessageType.SHARE_CONTENT, content);