feat(#23): Add email notifications
This commit is contained in:
26
legalconsenthub/app/composables/user/useUser.ts
Normal file
26
legalconsenthub/app/composables/user/useUser.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { UpdateEmailPreferencesDto, UserDto } from '~~/.api-client'
|
||||
import { useUserApi } from '~/composables'
|
||||
|
||||
export function useUser() {
|
||||
const userApi = useUserApi()
|
||||
|
||||
async function getUserById(userId: string): Promise<UserDto> {
|
||||
return await userApi.getUserById(userId)
|
||||
}
|
||||
|
||||
async function updateEmailPreferences(
|
||||
userId: string,
|
||||
email: string | null,
|
||||
emailOnFormCreated: boolean,
|
||||
emailOnFormSubmitted: boolean
|
||||
): Promise<UserDto> {
|
||||
const updateDto: UpdateEmailPreferencesDto = { email, emailOnFormCreated, emailOnFormSubmitted }
|
||||
|
||||
return await userApi.updateEmailPreferences(userId, updateDto)
|
||||
}
|
||||
|
||||
return {
|
||||
getUserById,
|
||||
updateEmailPreferences
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user