Skip to content

Commit

Permalink
chore: use mock serve
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv committed May 11, 2024
1 parent 3d57f96 commit aa0aeca
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ dist
.env
.vscode
*.zip
data
mock
dev-dist
2 changes: 1 addition & 1 deletion components/icons/IconsUnPreset.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div inline-block space-x-1 select-none>
<i i-my-logos-unpreset />
<i rd i-my-logos-unpreset />
<a
trans linear-text shape-bl o-unpreset-to from-unpreset-from to-unpreset-to href="https://github.com/unpreset"
target="_blank"
Expand Down
13 changes: 12 additions & 1 deletion public/logos/unpreset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion server/api/contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ContributeData } from '~/types'

export default defineEventHandler(async (event) => {
if (import.meta.dev)
return (await import('~/data/contributions.json')).default as ContributeData
return (await import('~/mock/contributions.json')).default as ContributeData

const { name, year } = getQuery(event)
const API = `https://github-contributions-api.jogruber.de/v4/${name}?y=${year}`
Expand Down
2 changes: 1 addition & 1 deletion server/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineEventHandler(async () => {
// return data

if (import.meta.dev)
return (await import('~/data/user.json')).default as User
return (await import('~/mock/user.json')).default as User

return $fetch<User>('https://api.github.com/users/zyyv')
})
5 changes: 4 additions & 1 deletion server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "../.nuxt/tsconfig.server.json"
"extends": "../.nuxt/tsconfig.server.json",
"exclude": [
"eslint.config.js"
]
}

0 comments on commit aa0aeca

Please sign in to comment.