Skip to content

Commit

Permalink
1,602nd Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Dec 20, 2024
1 parent 79ab0be commit 898e442
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useLocale from './locales';
const router = useRouter();
const route = useRoute();
const { state, getters, actions, $reset } = useStore();
const { state, actions, $reset } = useStore();
const locale = useLocale();
onMounted(() => actions.initialize());
Expand Down
16 changes: 7 additions & 9 deletions app/src/routes/(backstage)/(playground)/users/[[id]]/store.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { reactive } from 'vue';
import { defineStore } from 'vue-storer';
import { useNotification, request } from '@x/ui';
import { request } from '@x/ui';

import type { State, User } from './types';

export default defineStore('/users', () => {
const notification = useNotification();

const state = reactive<State>({
usersDialog: false,
usersFilter: {},
Expand Down Expand Up @@ -52,7 +50,7 @@ export default defineStore('/users', () => {
state.userDialog = true;
},
async createUser() {
const response = await request<any>('/users/new', {
await request<any>('/users/new', {
method: 'POST',
body: state.userForm,
});
Expand All @@ -66,28 +64,28 @@ export default defineStore('/users', () => {
}
},
async saveUser() {
const response = await request<any>(`/users/${state.userForm._id}`, {
await request<any>(`/users/${state.userForm._id}`, {
method: 'PUT',
body: state.userForm,
});
},
async suspendUser(row: User) {
const response = await request<any>(`/users/${row._id}`, {
await request<any>(`/users/${row._id}`, {
method: 'PUT',
body: { ...row, status: false },
});
},
async activeUser(row: User) {
const response = await request<any>(`/users/${row._id}`, {
await request<any>(`/users/${row._id}`, {
method: 'PUT',
body: { ...row, status: true },
});
},
async settingUser(row: User) {
const response = await request<any>(`/users/${row._id}/settings`);
await request<any>(`/users/${row._id}/settings`);
},
async deleteUser() {
const response = await request(`/users/${state.deleteContent._id}`, { method: 'DELETE' });
await request(`/users/${state.deleteContent._id}`, { method: 'DELETE' });
},
});

Expand Down

0 comments on commit 898e442

Please sign in to comment.