Skip to content

Commit

Permalink
[bugfix] fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreezag committed Apr 23, 2024
1 parent ce508b0 commit 2c39120
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions plugins/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useSettings } from "~/src/shared/lib/use-settings";
// todo: use store for token
export default defineNuxtPlugin(async () => {
const {
api: {getSettings},
api,
} = useSettings();

let settings = {
Expand All @@ -15,7 +15,7 @@ export default defineNuxtPlugin(async () => {
}

try {
settings = await getSettings()
settings = await api.getSettings()
} catch (e) {
console.error('Server is not available!')
}
Expand Down
4 changes: 2 additions & 2 deletions src/shared/lib/io/use-events-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type TUseEventsRequests = () => {
export const useEventsRequests: TUseEventsRequests = () => {
const app = useNuxtApp()
const {token} = app.$authToken
const headers = {"X-Auth-Token": token}
const headers = {"X-Auth-Token": token || ''}
const getEventRestUrl = (param?: string): string => `${REST_API_URL}/api/event${param ? `/${param}` : 's'}`

const getAll = () => fetch(getEventRestUrl(), {headers})
const getAll = () => fetch(getEventRestUrl(), { headers })
.then((response) => response.json())
.then((response) => {
if (response?.data) {
Expand Down
6 changes: 5 additions & 1 deletion src/shared/lib/use-settings/use-settings.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { useNuxtApp } from "#app"; // eslint-disable-line @conarti/feature-sliced/layers-slices
import type { Profile } from "../../types";
import { REST_API_URL } from "../io";


type TUseSettings = {
api: {
getVersion: () => Promise<string>
getProfile: () => Promise<Profile>
getSettings: () => Promise<unknown>
}
}

Expand All @@ -21,7 +25,7 @@ export const useSettings = (): TUseSettings => {
.catch(() => 'unknown');

const getProfile = () => fetch(`${REST_API_URL}/api/me`, {
headers: {"X-Auth-Token": nuxtApp.$authToken.token}
headers: {"X-Auth-Token": nuxtApp.$authToken.token || ""}
})
.then((response) => response.json())
.catch(() => 'unknown');
Expand Down
1 change: 0 additions & 1 deletion src/widgets/ui/page-placeholder/page-placeholder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const items = [
:key="item.title"
:icon-name="item.iconName"
:title="item.title"
:link-name="item.linkName"
:link-url="item.linkUrl"
/>
</ul>
Expand Down
13 changes: 12 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"extends": "./.nuxt/tsconfig.json"
"extends": "./.nuxt/tsconfig.json",
"include": [
"src/**/*.vue",
".nuxt/nuxt.d.ts",
".nuxt/.config/nuxt.*",
".nuxt/**/*",
".nuxt/node_modules/@nuxtjs/tailwindcss/runtime",
".nuxt/node_modules/@pinia/nuxt/runtime",
".nuxt/node_modules/@nuxt/devtools/runtime",
".nuxt/node_modules/@nuxt/telemetry/runtime",
".nuxt"
]
}

0 comments on commit 2c39120

Please sign in to comment.