-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: user controllerId instead of agentId
- Loading branch information
1 parent
819e0b6
commit f1947a2
Showing
4 changed files
with
60 additions
and
31 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
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,27 +1,50 @@ | ||
import { browserStorageService } from "@pages/background/services/browser-storage" | ||
import { browserStorageService } from "@pages/background/services/browser-storage"; | ||
|
||
const USER_ENUMS = { | ||
PASSCODE: "user-passcode" | ||
} | ||
PASSCODE: "user-passcode", | ||
CONTROLLER_ID: "controller-id", | ||
}; | ||
|
||
const User = () => { | ||
const getPasscode = async () : Promise<string> => { | ||
return await browserStorageService.getValue(USER_ENUMS.PASSCODE) as string; | ||
} | ||
|
||
const removePasscode = async () => { | ||
await browserStorageService.removeKey(USER_ENUMS.PASSCODE); | ||
} | ||
|
||
const setPasscode = async (passcode: string) => { | ||
await browserStorageService.setValue(USER_ENUMS.PASSCODE, passcode) | ||
} | ||
|
||
return { | ||
removePasscode, | ||
getPasscode, | ||
setPasscode | ||
} | ||
} | ||
|
||
export const userService = User() | ||
const getPasscode = async (): Promise<string> => { | ||
return (await browserStorageService.getValue( | ||
USER_ENUMS.PASSCODE | ||
)) as string; | ||
}; | ||
|
||
const removePasscode = async () => { | ||
await browserStorageService.removeKey(USER_ENUMS.PASSCODE); | ||
}; | ||
|
||
const setPasscode = async (passcode: string) => { | ||
await browserStorageService.setValue(USER_ENUMS.PASSCODE, passcode); | ||
}; | ||
|
||
const getControllerId = async (): Promise<string> => { | ||
return (await browserStorageService.getValue( | ||
USER_ENUMS.CONTROLLER_ID | ||
)) as string; | ||
}; | ||
|
||
const removeControllerId = async () => { | ||
await browserStorageService.removeKey(USER_ENUMS.CONTROLLER_ID); | ||
}; | ||
|
||
const setControllerId = async (controllerId: string) => { | ||
await browserStorageService.setValue( | ||
USER_ENUMS.CONTROLLER_ID, | ||
controllerId | ||
); | ||
}; | ||
|
||
return { | ||
removePasscode, | ||
getPasscode, | ||
setPasscode, | ||
getControllerId, | ||
setControllerId, | ||
removeControllerId, | ||
}; | ||
}; | ||
|
||
export const userService = User(); |