migrate vuex modules

This commit is contained in:
AceDataCloud committed 2023-12-28 03:11:04 +08:00
1 parent 9c5ce9acf3
commit f39e155301
17 files changed
+177 -133

No files matched your search

+2 -2
View File
@@ -113,7 +113,7 @@ export default defineComponent({
async onFetchApplications() {
this.initializing = true;
const { data: applications } = await applicationOperator.getAll({
user_id: this.$store.state.user.id,
user_id: this.$store.state.common.user.id,
api_id: [
CHAT_MODEL_CHATGPT.apiId,
CHAT_MODEL_CHATGPT_16K.apiId,
@@ -141,7 +141,7 @@ export default defineComponent({
const {
data: { items: apiUsages }
} = await apiUsageOperator.getAll({
user_id: this.$store.state.user.id,
user_id: this.$store.state.common.user.id,
// @ts-ignore
application_id: this.applications?.map((application) => application.id),
offset: 0,
+1 -1
View File
@@ -51,7 +51,7 @@ export default defineComponent({
methods: {
onLogout() {
console.debug('logout');
this.$store.dispatch('resetToken');
this.$store.dispatch('common/resetToken');
this.$router.push({ name: ROUTE_AUTH_LOGIN });
}
}
+4 -4
View File
@@ -43,20 +43,20 @@ export default defineComponent({
computed: {
stream: {
get() {
return this.$store.getters.setting.stream;
return this.$store.getters['common/setting'].stream;
},
set(value: boolean) {
this.$store.dispatch('setSetting', {
this.$store.dispatch('common/setSetting', {
stream: value
});
}
},
endpoint: {
get() {
return this.$store.getters.setting.endpoint;
return this.$store.getters['common/setting'].endpoint;
},
set(value: string) {
this.$store.dispatch('setSetting', {
this.$store.dispatch('common/setSetting', {
endpoint: value
});
}
+2 -2
View File
@@ -64,8 +64,8 @@ export default defineComponent({
preset: {
handler(val) {
this.$emit('update:modelValue', val);
this.$store.dispatch('setMidjourney', {
preset: val
this.$store.dispatch('midjourney/setPreset', {
...val
});
},
deep: true,
+1 -1
View File
@@ -50,7 +50,7 @@ export default defineComponent({
computed: {
headers() {
return {
Authorization: `Bearer ${this.$store.state.token.access}`
Authorization: `Bearer ${this.$store.state.common.token.access}`
};
},
urls() {
@@ -79,7 +79,7 @@ export default defineComponent({
const {
data: { items: apiUsages }
} = await apiUsageOperator.getAll({
user_id: this.$store.state.user.id,
user_id: this.$store.state.common.user.id,
application_id: this.applications?.map((application) => application.id),
offset: 0,
limit: 5,
@@ -116,7 +116,7 @@ export default defineComponent({
const {
data: { items: apiUsages, count }
} = await apiUsageOperator.getAll({
user_id: this.$store.state.user.id,
user_id: this.$store.state.common.user.id,
application_id: this.applications?.map((application) => application.id),
offset: (this.page - 1) * this.limit,
limit: this.limit,