diff --git a/src/components/NewItemForm.vue b/src/components/NewItemForm.vue
index 029c7fe..63fa5d6 100644
--- a/src/components/NewItemForm.vue
+++ b/src/components/NewItemForm.vue
@@ -1,12 +1,17 @@
-
+
Add New Item
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Submit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Submit
+ Clear
+
diff --git a/src/stores/powerItems.ts b/src/stores/powerItems.ts
index e77cc3c..b71418a 100644
--- a/src/stores/powerItems.ts
+++ b/src/stores/powerItems.ts
@@ -4,19 +4,19 @@ import { defineStore } from 'pinia'
import { computed, ref, toRaw } from 'vue'
import axiosRetry from 'axios-retry'
import { getCurrentInstance } from 'vue'
-import { apiBaseURL as apiBaseURLKey } from '@/types/ConfigSymbols'
+import { apiBaseURL, apiBaseURL as apiBaseURLKey } from '@/types/ConfigSymbols'
import { inject } from 'vue'
const BLESSING = 1
const INTIMACY = 2
const FELLOW = 3
-const noCacheConfig:AxiosRequestConfig = {
- responseType: "json",
+const noCacheConfig: AxiosRequestConfig = {
+ responseType: 'json',
headers: {
'Cache-Control': 'no-cache',
- 'Pragma': 'no-cache',
- 'Expires': '0',
+ Pragma: 'no-cache',
+ Expires: '0'
}
}
@@ -28,17 +28,14 @@ export const usePowerItems = defineStore('powerItems', () => {
const fellowPowerItems = ref(new Map())
const intimacyPowerItems = ref(new Map())
const isLoadComplete = ref(false)
- const auth = getCurrentInstance()?.appContext.config.globalProperties.$zitadel
- auth?.oidcAuth.mgr.getUser().then(res => console.log(res?.id_token))
- console.log(auth?.oidcAuth.accessToken)
+ const apiBaseURL = inject(apiBaseURLKey)!
axiosRetry(axios, {
retries: 3,
- retryDelay: axiosRetry.exponentialDelay,
- })
+ retryDelay: axiosRetry.exponentialDelay
+ })
async function fetchPowerItems() {
- const apiBaseURL = inject(apiBaseURLKey)
axios
.get(apiBaseURL + '/powerItems/byType/' + BLESSING + '/asMap', noCacheConfig)
.then((resp) => {
@@ -131,6 +128,19 @@ export const usePowerItems = defineStore('powerItems', () => {
}, {})
}
+ function addPowerItem(newItem: PowerItem): Promise {
+ const resultPromise: Promise = new Promise((resolve, reject) => {
+ axios
+ .post(apiBaseURL + '/powerItems/', newItem, noCacheConfig)
+ .then((resp) => {
+ resolve(resp.data)
+ })
+ .catch((rejected) => reject(rejected))
+ })
+
+ return resultPromise
+ }
+
const totalBlessingPower = computed(() =>
[...blessingPowerItems.value.values()].reduce(
(accumulator: number, currentValue: PowerItem) => {
diff --git a/src/types/PowerItem.ts b/src/types/PowerItem.ts
index 3ee69ff..9d29de1 100644
--- a/src/types/PowerItem.ts
+++ b/src/types/PowerItem.ts
@@ -1,4 +1,5 @@
export type PowerItem = {
+ itemType: number
iconURL: string
itemName: string
minItemPower: number
@@ -7,5 +8,5 @@ export type PowerItem = {
rarity: number
origin: string
tooltip: string
- isEventItem: string
+ isEventItem: boolean
}