Skip to content

Commit 5232f91

Browse files
committed
feat: added dirty trick to have a valid link for updating the module
1 parent 00ee3f0 commit 5232f91

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/components/PsAccounts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<template v-else>
99
<AlertUpdateToLatest
1010
v-if="!context.psAccountsVersion || !satisfies(context.psAccountsVersion, '>=7.0.0')"
11-
:update-link="context.psAccountsUpdateLink"
11+
:enable-link="context.psAccountsEnableLink"
1212
class="acc-mb-4"
1313
/>
1414
<AlertModuleDependencies

src/components/alert/AlertUpdateToLatest.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ import { useLocale } from '@/composables/useLocale';
1414
import { PuikSnackbar } from '@prestashopcorp/puik';
1515
1616
interface AlertUpdateToLatestProps {
17-
updateLink: string | null;
17+
enableLink: string | null;
1818
}
1919
2020
const props = defineProps<AlertUpdateToLatestProps>();
2121
2222
const { t } = useLocale();
2323
2424
const update = async () => {
25-
if (props.updateLink) {
25+
if (props.enableLink) {
2626
try {
27-
// TODO:
28-
const response = await fetch('', { method: 'POST' });
27+
const link = props.enableLink?.replace('enable', 'upgrade');
28+
const response = await fetch(link, { method: 'POST' });
2929
if (!response.ok) {
3030
throw new Error(`An error has occured: ${response.status}`);
3131
}
3232
const data = await response.json();
3333
34-
if (data.update.status === false) {
34+
if (data.ps_accounts.status === false) {
3535
throw new Error('Cannot update ps_accounts module.');
3636
}
3737
window.location.reload();

0 commit comments

Comments
 (0)