Skip to content

Commit

Permalink
login bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-luna-ray committed Nov 27, 2023
1 parent 330b317 commit 7e861ad
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 162 deletions.
4 changes: 2 additions & 2 deletions client/src/pages/DashboardPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</style>

<script setup>
import { onMounted } from 'vue';
import { onBeforeMount } from 'vue';
import { storeToRefs } from 'pinia';
import { useBudgetStore } from '@/stores/budget';
Expand All @@ -49,7 +49,7 @@ const budgetStore = useBudgetStore();
const { userBudgets } = storeToRefs(budgetStore);
// Lifecycle
onMounted(async () => {
onBeforeMount(async () => {
await budgetStore.fetchUserBudgets();
})
</script>
4 changes: 1 addition & 3 deletions client/src/stores/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { useRouter } from 'vue-router';
import { defineStore } from 'pinia';
import { jwtDecode } from 'jwt-decode';
import { useStorage } from '@vueuse/core';
import { usePostStore } from '@/stores/posts';
import { API_BASE_URL } from '@/lib/api';

export const useAuthStore = defineStore('auth', () => {
const router = useRouter();
const authState = useStorage('exchequer', { token: null });
const postStore = usePostStore();

// State
const loginEmail = ref('');
Expand Down Expand Up @@ -79,7 +77,7 @@ export const useAuthStore = defineStore('auth', () => {
if (token) {
authState.value.token = token;
resetLoginValues();
postStore.fetchPosts();
// postStore.fetchPosts();
router.push('/dashboard');
}
} catch (error) {
Expand Down
112 changes: 0 additions & 112 deletions client/src/stores/posts.js

This file was deleted.

2 changes: 0 additions & 2 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { requireAuth } from './middleware/authMiddleware.mjs';

import postRoutes from './routes/post.mjs';
import authRoutes from './routes/auth.mjs';
import budgetRoutes from './routes/budget.mjs';

Expand Down Expand Up @@ -40,7 +39,6 @@ app.use(express.json());

// Routes
app.use(`${API_BASE_PATH}/auth`, authRoutes);
app.use(`${API_BASE_PATH}/posts`, requireAuth, postRoutes);
app.use(`${API_BASE_PATH}/budget`, requireAuth, budgetRoutes);

// Static
Expand Down
14 changes: 0 additions & 14 deletions models/Expense.mjs

This file was deleted.

13 changes: 0 additions & 13 deletions models/Post.mjs

This file was deleted.

15 changes: 0 additions & 15 deletions models/Transaction.mjs

This file was deleted.

1 change: 0 additions & 1 deletion routes/budget.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ router.get('/', async (req, res) => {
res.status(500).json({ error: 'Could not fetch user budgets' });
}
});

router.get('/:budgetId', async (req, res) => {
try {
const { userId } = req.decodedToken;
Expand Down

0 comments on commit 7e861ad

Please sign in to comment.