Add ticket header
parent
ec0a5f4574
commit
681af3955c
|
@ -71,8 +71,12 @@ export default {
|
|||
this.$toast.add({ severity: 'error', summary: 'Not Available', detail: 'A license is required to download', life: 3000 });
|
||||
} else {
|
||||
try {
|
||||
const response = await $fetch(this.designerApiBase + '/theme/download/' + this.$appState.designer.licenseKey + '/' + theme.t_key, {
|
||||
responseType: 'blob'
|
||||
const response = await $fetch(this.designerApiBase + '/theme/download/' + theme.t_key, {
|
||||
responseType: 'blob',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
}
|
||||
});
|
||||
|
||||
if (response.error) {
|
||||
|
@ -96,6 +100,10 @@ export default {
|
|||
async saveTheme(theme) {
|
||||
const { error } = await $fetch(this.designerApiBase + '/theme/update', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
},
|
||||
body: {
|
||||
key: theme.key,
|
||||
preset: theme.preset,
|
||||
|
|
|
@ -100,10 +100,13 @@ export default {
|
|||
if (this.$appState.designer.licenseKey) {
|
||||
const { data, error } = await $fetch(this.designerApiBase + '/theme/create', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
},
|
||||
body: {
|
||||
name: this.themeName,
|
||||
preset: newPreset,
|
||||
license_key: this.$appState.designer.licenseKey,
|
||||
config: {
|
||||
font_size: '14px',
|
||||
font_family: 'Inter var'
|
||||
|
@ -125,10 +128,13 @@ export default {
|
|||
if (this.$appState.designer.licenseKey) {
|
||||
const { data, error } = await $fetch(this.designerApiBase + '/theme/figma', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
},
|
||||
body: {
|
||||
name: this.themeName,
|
||||
figma_tokens: this.figmaData,
|
||||
license_key: this.$appState.designer.licenseKey,
|
||||
config: {
|
||||
font_size: '14px',
|
||||
font_family: 'Inter var'
|
||||
|
|
|
@ -134,13 +134,15 @@ export default {
|
|||
} else {
|
||||
if (data.valid) {
|
||||
this.$appState.designer.licenseKey = this.licenseKey;
|
||||
this.$appState.designer.ticket = data.ticket;
|
||||
|
||||
this.loadThemes();
|
||||
|
||||
localStorage.setItem(this.$appState.designer.localStoreKey, this.licenseKey);
|
||||
|
||||
if (!silent) {
|
||||
this.$toast.add({ severity: 'success', summary: 'Success', detail: 'License is activated.', life: 3000 });
|
||||
}
|
||||
|
||||
this.loadThemes();
|
||||
localStorage.setItem(this.$appState.designer.localStoreKey, this.$appState.designer.licenseKey);
|
||||
} else {
|
||||
this.$toast.add({ severity: 'warn', summary: 'Unable to Activate', detail: 'Invalid key', life: 3000 });
|
||||
this.$appState.designer.themes = [];
|
||||
|
@ -152,7 +154,12 @@ export default {
|
|||
},
|
||||
async loadThemes() {
|
||||
this.loading = true;
|
||||
const { data, error } = await $fetch(this.designerApiBase + '/theme/list/' + this.$appState.designer.licenseKey);
|
||||
const { data, error } = await $fetch(this.designerApiBase + '/theme/list/', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
this.$toast.add({ severity: 'error', summary: 'An Error Occurred', detail: error.message, life: 3000 });
|
||||
|
@ -163,7 +170,12 @@ export default {
|
|||
this.loading = false;
|
||||
},
|
||||
async loadTheme(theme) {
|
||||
const { data, error } = await $fetch(this.designerApiBase + '/theme/load/' + this.$appState.designer.licenseKey + '/' + theme.t_key);
|
||||
const { data, error } = await $fetch(this.designerApiBase + '/theme/load/' + theme.t_key, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
this.$toast.add({ severity: 'error', summary: 'An Error Occurred', detail: error.message, life: 3000 });
|
||||
|
@ -185,9 +197,12 @@ export default {
|
|||
async renameTheme(theme) {
|
||||
const { error } = await $fetch(this.designerApiBase + '/theme/rename/' + theme.t_key, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
},
|
||||
body: {
|
||||
name: theme.t_name,
|
||||
license_key: this.$appState.designer.licenseKey
|
||||
name: theme.t_name
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -198,8 +213,9 @@ export default {
|
|||
async deleteTheme(theme) {
|
||||
const { error } = await $fetch(this.designerApiBase + '/theme/delete/' + theme.t_key, {
|
||||
method: 'DELETE',
|
||||
body: {
|
||||
license_key: this.$appState.designer.licenseKey
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -212,8 +228,9 @@ export default {
|
|||
async duplicateTheme(theme) {
|
||||
const { error } = await $fetch(this.designerApiBase + '/theme/duplicate/' + theme.t_key, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
license_key: this.$appState.designer.licenseKey
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -92,6 +92,10 @@ export default {
|
|||
async preview() {
|
||||
const { data, error } = await $fetch(this.designerApiBase + '/theme/migrate/preview/' + this.$appState.designer.theme.key, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
},
|
||||
body: {
|
||||
license_key: this.$appState.designer.licenseKey
|
||||
}
|
||||
|
@ -124,6 +128,10 @@ export default {
|
|||
async migrate() {
|
||||
const { error } = await $fetch(this.designerApiBase + '/theme/migrate/execute/' + this.$appState.designer.theme.key, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.$appState.designer.ticket}`,
|
||||
'X-License-Key': this.$appState.designer.licenseKey
|
||||
},
|
||||
body: {
|
||||
license_key: this.$appState.designer.licenseKey
|
||||
}
|
||||
|
|
|
@ -15,8 +15,9 @@ const $appState = {
|
|||
announcement: null,
|
||||
storageKey: 'primevue',
|
||||
designer: {
|
||||
localStoreKey: 'primevue-designer-licensekey',
|
||||
localStoreKey: 'primevue-designer',
|
||||
licenseKey: null,
|
||||
ticket: null,
|
||||
active: false,
|
||||
activeView: 'dashboard',
|
||||
activeTab: '0',
|
||||
|
|
Loading…
Reference in New Issue