2021-09-16 21:08:02 +02:00
|
|
|
import { serv_constants } from '@store/Modules/serv_constants'
|
|
|
|
|
|
|
|
|
|
import { tools } from '@store/Modules/tools'
|
|
|
|
|
|
2023-02-15 21:40:10 +01:00
|
|
|
import { computed, defineComponent, ref } from 'vue'
|
2021-09-16 21:08:02 +02:00
|
|
|
import { useI18n } from '@src/boot/i18n'
|
|
|
|
|
import { useUserStore } from '@store/UserStore'
|
|
|
|
|
import { useGlobalStore } from '@store/globalStore'
|
|
|
|
|
import { useQuasar } from 'quasar'
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'Unsubscribe',
|
|
|
|
|
components: {},
|
|
|
|
|
setup(props, { emit }) {
|
|
|
|
|
const $q = useQuasar()
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const $route = useRoute()
|
|
|
|
|
|
|
|
|
|
const risultato = ref('...')
|
|
|
|
|
const riscode = ref(0)
|
2023-02-15 21:40:10 +01:00
|
|
|
const param = ref(<any>null)
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2023-02-15 21:40:10 +01:00
|
|
|
const disiscritto = computed(() => {
|
2021-09-16 21:08:02 +02:00
|
|
|
return riscode.value === serv_constants.RIS_UNSUBSCRIBED_OK
|
2023-02-15 21:40:10 +01:00
|
|
|
})
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2023-02-15 21:40:10 +01:00
|
|
|
const errore = computed(() => {
|
2021-09-16 21:08:02 +02:00
|
|
|
return riscode.value !== serv_constants.RIS_UNSUBSCRIBED_OK
|
2023-02-15 21:40:10 +01:00
|
|
|
})
|
2021-09-16 21:08:02 +02:00
|
|
|
|
2023-02-15 21:40:10 +01:00
|
|
|
const email = computed(() => {
|
2021-09-16 21:08:02 +02:00
|
|
|
return $route.query.email
|
2023-02-15 21:40:10 +01:00
|
|
|
})
|
2021-09-16 21:08:02 +02:00
|
|
|
|
|
|
|
|
function load() {
|
|
|
|
|
// console.log('load')
|
2023-02-15 21:40:10 +01:00
|
|
|
param.value = { em: $route.query.em, mc: $route.query.mc, locale: tools.getLocale() }
|
|
|
|
|
console.log('idlink = ', param.value)
|
2024-02-08 01:35:23 +01:00
|
|
|
const vecchio_sistema = false;
|
|
|
|
|
let ris = null;
|
|
|
|
|
ris = userStore.unsubscribe(param.value)
|
|
|
|
|
return ris
|
2021-09-16 21:08:02 +02:00
|
|
|
.then((ris: any) => {
|
|
|
|
|
riscode.value = ris.code
|
|
|
|
|
risultato.value = ris.msg
|
|
|
|
|
|
2021-09-19 02:59:24 +02:00
|
|
|
}).catch((err: any) => {
|
2021-09-16 21:08:02 +02:00
|
|
|
console.log('ERR = ' + err)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
load()
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
disiscritto,
|
|
|
|
|
errore,
|
|
|
|
|
email,
|
|
|
|
|
risultato,
|
2023-02-15 21:40:10 +01:00
|
|
|
param,
|
2021-09-16 21:08:02 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|