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