-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
988 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export * as Register from './register' | ||
export { forgotPassword } from './forgotPassword' | ||
export { resendVerification } from './resendVerification' | ||
export { useUserProfileEditApi } from './useUserProfileEditApi' | ||
export { useUserPasswordEditApi } from './useUserPasswordEditApi' | ||
export { useUserEmailEditApi } from './useUserEmailEditApi' |
45 changes: 45 additions & 0 deletions
45
packages/sprinkle-account/app/assets/composables/useUserEmailEditApi.ts
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ref } from 'vue' | ||
import axios from 'axios' | ||
import { Severity } from '@userfrosting/sprinkle-core/interfaces' | ||
import type { ApiResponse, AlertInterface } from '@userfrosting/sprinkle-core/interfaces' | ||
import type { EmailEditRequest } from '../interfaces' | ||
|
||
// TODO : Add validation | ||
// 'schema://requests/account-email.yaml' | ||
|
||
/** | ||
* API Composable | ||
*/ | ||
export function useUserEmailEditApi() { | ||
const apiLoading = ref<Boolean>(false) | ||
const apiError = ref<AlertInterface | null>(null) | ||
|
||
async function submitEmailEdit(data: EmailEditRequest) { | ||
apiLoading.value = true | ||
apiError.value = null | ||
return axios | ||
.post<ApiResponse>('/account/settings/email', data) | ||
.then((response) => { | ||
return { | ||
message: response.data.message | ||
} | ||
}) | ||
.catch((err) => { | ||
apiError.value = { | ||
...{ | ||
description: 'An error as occurred', | ||
style: Severity.Danger, | ||
closeBtn: true | ||
}, | ||
...err.response.data | ||
} | ||
|
||
throw apiError.value | ||
}) | ||
.finally(() => { | ||
apiLoading.value = false | ||
}) | ||
} | ||
|
||
return { submitEmailEdit, apiLoading, apiError } | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/sprinkle-account/app/assets/composables/useUserPasswordEditApi.ts
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ref } from 'vue' | ||
import axios from 'axios' | ||
import { Severity } from '@userfrosting/sprinkle-core/interfaces' | ||
import type { ApiResponse, AlertInterface } from '@userfrosting/sprinkle-core/interfaces' | ||
import type { PasswordEditRequest } from '../interfaces' | ||
|
||
// TODO : Add validation | ||
// 'schema://requests/account-settings.yaml' | ||
|
||
/** | ||
* API Composable | ||
*/ | ||
export function useUserPasswordEditApi() { | ||
const apiLoading = ref<Boolean>(false) | ||
const apiError = ref<AlertInterface | null>(null) | ||
|
||
async function submitPasswordEdit(data: PasswordEditRequest) { | ||
apiLoading.value = true | ||
apiError.value = null | ||
return axios | ||
.post<ApiResponse>('/account/settings', data) | ||
.then((response) => { | ||
return { | ||
message: response.data.message | ||
} | ||
}) | ||
.catch((err) => { | ||
apiError.value = { | ||
...{ | ||
description: 'An error as occurred', | ||
style: Severity.Danger, | ||
closeBtn: true | ||
}, | ||
...err.response.data | ||
} | ||
|
||
throw apiError.value | ||
}) | ||
.finally(() => { | ||
apiLoading.value = false | ||
}) | ||
} | ||
|
||
return { submitPasswordEdit, apiLoading, apiError } | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/sprinkle-account/app/assets/composables/useUserProfileEditApi.ts
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ref } from 'vue' | ||
import axios from 'axios' | ||
import { Severity } from '@userfrosting/sprinkle-core/interfaces' | ||
import type { ApiResponse, AlertInterface } from '@userfrosting/sprinkle-core/interfaces' | ||
import type { ProfileEditRequest } from '../interfaces' | ||
|
||
// TODO : Add validation | ||
// 'schema://requests/profile-settings.yaml' | ||
|
||
/** | ||
* API Composable | ||
*/ | ||
export function useUserProfileEditApi() { | ||
const apiLoading = ref<Boolean>(false) | ||
const apiError = ref<AlertInterface | null>(null) | ||
|
||
async function submitProfileEdit(data: ProfileEditRequest) { | ||
apiLoading.value = true | ||
apiError.value = null | ||
return axios | ||
.post<ApiResponse>('/account/settings/profile', data) | ||
.then((response) => { | ||
return { | ||
message: response.data.message | ||
} | ||
}) | ||
.catch((err) => { | ||
apiError.value = { | ||
...{ | ||
description: 'An error as occurred', | ||
style: Severity.Danger, | ||
closeBtn: true | ||
}, | ||
...err.response.data | ||
} | ||
|
||
throw apiError.value | ||
}) | ||
.finally(() => { | ||
apiLoading.value = false | ||
}) | ||
} | ||
|
||
return { submitProfileEdit, apiLoading, apiError } | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/sprinkle-account/app/assets/interfaces/EmailEditApi.ts
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* API Interfaces - What the API expects and what it returns | ||
* | ||
* This interface is tied to the `ProfileEmailEditAction` API, accessed at the | ||
* POST `/account/settings/email` endpoint. | ||
* | ||
* This api doesn't have a corresponding Response data interface. | ||
* The General API Response interface is used. | ||
*/ | ||
// TODO : Email should be it's own form | ||
export interface EmailEditRequest { | ||
email: string | ||
passwordcheck: string | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/sprinkle-account/app/assets/interfaces/PasswordEditApi.ts
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* API Interfaces - What the API expects and what it returns | ||
* | ||
* This interface is tied to the `SettingsEditAction` API, accessed at the | ||
* POST `/account/settings` endpoint. | ||
* | ||
* This api doesn't have a corresponding Response data interface. | ||
* The General API Response interface is used. | ||
*/ | ||
// TODO : Email should be it's own form | ||
export interface PasswordEditRequest { | ||
passwordcheck: string | ||
password: string | ||
passwordc: string | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/sprinkle-account/app/assets/interfaces/ProfileEditApi.ts
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* API Interfaces - What the API expects and what it returns | ||
* | ||
* This interface is tied to the `ProfileEditAction` API, accessed at the | ||
* POST `/account/settings/profile` endpoint. | ||
* | ||
* This api doesn't have a corresponding Response data interface. | ||
* The General API Response interface is used. | ||
*/ | ||
export interface ProfileEditRequest { | ||
first_name: string | ||
last_name: string | ||
locale: string | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<UFPageUserSettings /> | ||
</template> |
3 changes: 3 additions & 0 deletions
3
packages/sprinkle-account/app/assets/views/UserSettingsEmail.vue
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<UFPageUserSettingsEmail /> | ||
</template> |
3 changes: 3 additions & 0 deletions
3
packages/sprinkle-account/app/assets/views/UserSettingsPassword.vue
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<UFPageUserSettingsPassword /> | ||
</template> |
3 changes: 3 additions & 0 deletions
3
packages/sprinkle-account/app/assets/views/UserSettingsProfile.vue
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<UFPageUserSettingsProfile /> | ||
</template> |
17 changes: 17 additions & 0 deletions
17
packages/sprinkle-account/app/schema/requests/account-email.yaml
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
passwordcheck: | ||
validators: | ||
required: | ||
message: PASSWORD.CONFIRM_CURRENT | ||
email: | ||
validators: | ||
required: | ||
label: "&EMAIL" | ||
message: VALIDATE.REQUIRED | ||
length: | ||
label: "&EMAIL" | ||
min: 1 | ||
max: 150 | ||
message: VALIDATE.LENGTH_RANGE | ||
email: | ||
message: VALIDATE.INVALID_EMAIL |
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
Oops, something went wrong.