Merge pull request #309 from SamR1/export-endpoints-update-and-policy-fix
endpoints update and privacy policy display fix
This commit is contained in:
@ -212,7 +212,7 @@
|
||||
async function downloadArchive(filename: string) {
|
||||
generatingLink.value = true
|
||||
await authApi
|
||||
.get(`/auth/profile/export/${filename}`, {
|
||||
.get(`/auth/account/export/${filename}`, {
|
||||
responseType: 'blob',
|
||||
})
|
||||
.then((response) => {
|
||||
|
@ -129,6 +129,10 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
|
||||
AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
|
||||
res.data.data
|
||||
)
|
||||
if (!res.data.data.accepted_privacy_policy) {
|
||||
// refresh privacy policy
|
||||
context.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY)
|
||||
}
|
||||
if (res.data.data.language) {
|
||||
context.dispatch(
|
||||
ROOT_STORE.ACTIONS.UPDATE_APPLICATION_LANGUAGE,
|
||||
@ -452,7 +456,7 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
|
||||
): void {
|
||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||
authApi
|
||||
.post('auth/profile/export/request')
|
||||
.post('auth/account/export/request')
|
||||
.then((res) => {
|
||||
if (res.data.status === 'success') {
|
||||
context.commit(
|
||||
@ -470,7 +474,7 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
|
||||
): void {
|
||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||
authApi
|
||||
.get('auth/profile/export')
|
||||
.get('auth/account/export')
|
||||
.then((res) => {
|
||||
if (res.data.status === 'success') {
|
||||
context.commit(
|
||||
|
@ -51,6 +51,24 @@ export const actions: ActionTree<IRootState, IRootState> & IRootActions = {
|
||||
})
|
||||
.catch((error) => handleError(context, error))
|
||||
},
|
||||
[ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY](
|
||||
context: ActionContext<IRootState, IRootState>
|
||||
): void {
|
||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||
authApi
|
||||
.get('config')
|
||||
.then((res) => {
|
||||
if (res.data.status === 'success') {
|
||||
context.commit(
|
||||
ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_PRIVACY_POLICY,
|
||||
res.data.data
|
||||
)
|
||||
} else {
|
||||
handleError(context, null)
|
||||
}
|
||||
})
|
||||
.catch((error) => handleError(context, error))
|
||||
},
|
||||
[ROOT_STORE.ACTIONS.UPDATE_APPLICATION_CONFIG](
|
||||
context: ActionContext<IRootState, IRootState>,
|
||||
payload: TAppConfigForm
|
||||
|
@ -1,5 +1,6 @@
|
||||
export enum RootActions {
|
||||
GET_APPLICATION_CONFIG = 'GET_APPLICATION_CONFIG',
|
||||
GET_APPLICATION_PRIVACY_POLICY = 'GET_APPLICATION_PRIVACY_POLICY',
|
||||
GET_APPLICATION_STATS = 'GET_APPLICATION_STATS',
|
||||
UPDATE_APPLICATION_CONFIG = 'UPDATE_APPLICATION_CONFIG',
|
||||
UPDATE_APPLICATION_LANGUAGE = 'UPDATE_APPLICATION_LANGUAGE',
|
||||
@ -19,6 +20,7 @@ export enum RootMutations {
|
||||
SET_ERROR_MESSAGES = 'SET_ERROR_MESSAGES',
|
||||
UPDATE_APPLICATION_CONFIG = 'UPDATE_APPLICATION_CONFIG',
|
||||
UPDATE_APPLICATION_LOADING = 'UPDATE_APPLICATION_LOADING',
|
||||
UPDATE_APPLICATION_PRIVACY_POLICY = 'UPDATE_APPLICATION_PRIVACY_POLICY',
|
||||
UPDATE_APPLICATION_STATS = 'UPDATE_APPLICATION_STATS',
|
||||
UPDATE_LANG = 'UPDATE_LANG',
|
||||
}
|
||||
|
@ -27,6 +27,13 @@ export const mutations: MutationTree<IRootState> & TRootMutations = {
|
||||
) {
|
||||
state.appLoading = loading
|
||||
},
|
||||
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_PRIVACY_POLICY](
|
||||
state: IRootState,
|
||||
appConfig: TAppConfig
|
||||
) {
|
||||
state.application.config.privacy_policy = appConfig.privacy_policy
|
||||
state.application.config.privacy_policy_date = appConfig.privacy_policy_date
|
||||
},
|
||||
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_STATS](
|
||||
state: IRootState,
|
||||
statistics: IAppStatistics
|
||||
|
@ -30,6 +30,9 @@ export interface IRootActions {
|
||||
[ROOT_STORE.ACTIONS.GET_APPLICATION_STATS](
|
||||
context: ActionContext<IRootState, IRootState>
|
||||
): void
|
||||
[ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY](
|
||||
context: ActionContext<IRootState, IRootState>
|
||||
): void
|
||||
[ROOT_STORE.ACTIONS.UPDATE_APPLICATION_CONFIG](
|
||||
context: ActionContext<IRootState, IRootState>,
|
||||
payload: TAppConfigForm
|
||||
@ -70,6 +73,10 @@ export type TRootMutations<S = IRootState> = {
|
||||
state: S,
|
||||
loading: boolean
|
||||
): void
|
||||
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_PRIVACY_POLICY](
|
||||
state: S,
|
||||
config: TAppConfig
|
||||
): void
|
||||
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_STATS](
|
||||
state: S,
|
||||
statistics: IAppStatistics
|
||||
|
@ -136,6 +136,7 @@
|
||||
.privacy-policy-message {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 0 $default-margin*.5;
|
||||
}
|
||||
|
||||
@media screen and (max-width: $medium-limit) {
|
||||
|
@ -8,5 +8,15 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeMount } from 'vue'
|
||||
|
||||
import PrivacyPolicy from '@/components/PrivacyPolicy.vue'
|
||||
import { ROOT_STORE } from '@/store/constants'
|
||||
import { useStore } from '@/use/useStore'
|
||||
|
||||
const store = useStore()
|
||||
|
||||
onBeforeMount(() => {
|
||||
store.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY)
|
||||
})
|
||||
</script>
|
Reference in New Issue
Block a user