Skip to content

Commit 25f4730

Browse files
Benoit NgoNgob
authored andcommitted
Updating AppFetch, useAppFetch
Fixing various eslint errors
1 parent 16dd460 commit 25f4730

File tree

25 files changed

+1378
-443
lines changed

25 files changed

+1378
-443
lines changed

apps/back/src/Controller/HealthCheckController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class HealthCheckController
1313
#[Route('/healthcheck', name: 'app_health_check')]
1414
public function index(): JsonResponse
1515
{
16-
return new JsonResponse(['success' => true]);
16+
return new JsonResponse(['success' => 'ok']);
1717
}
1818

1919
#[Route('/healthcheck/logged', name: 'app_health_check_logged')]
2020
#[IsGranted('IS_AUTHENTICATED_FULLY')]
2121
public function logged(): JsonResponse
2222
{
23-
return new JsonResponse(['success' => true]);
23+
return new JsonResponse(['success' => 'ok']);
2424
}
2525
}

apps/back/src/Entity/User.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public function jsonSerialize(): mixed
100100
{
101101
return [
102102
'email' => $this->getEmail(),
103+
'username' => $this->getUsername(),
103104
];
104105
}
105106
}

apps/front/.eslintrc.cjs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ require("@rushstack/eslint-patch/modern-module-resolution")
22
module.exports = {
33
root: true,
44
extends: [
5-
"plugin:vue/vue3-recommended",
6-
"@nuxtjs/eslint-config-typescript",
7-
"@vue/eslint-config-airbnb-with-typescript"
5+
"@nuxt/eslint-config",
6+
// "plugin:vue/vue3-recommended"
87
],
98
rules: {
10-
'semi': ["error", "always"],
11-
'comma-dangle': "off", // covered by eslint-config-airbnb-with-typescript
12-
'space-before-function-paren': "off" // covered by eslint-config-airbnb-with-typescript
9+
'semi': ["error", "always"]
1310
}
1411
};

apps/front/nuxt.config.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
export default defineNuxtConfig({
33
srcDir: 'src/',
44
modules: [
5-
'@pinia/nuxt',
5+
'@pinia/nuxt'
66
],
77
runtimeConfig: {
8-
API_URL: process.env.API_URL || '',
8+
API_URL: process.env.API_URL || ''
99
},
1010
app: {
1111

@@ -17,21 +17,21 @@ export default defineNuxtConfig({
1717
meta: [
1818
// <meta name="description" content="My amazing site">
1919
// { name: 'description', content: 'My amazing site.' }
20-
],
21-
},
20+
]
21+
}
2222
},
2323
css: [
24-
'@/assets/styles/main.scss',
24+
'@/assets/styles/main.scss'
2525
],
2626
vite: {
2727
css: {
2828
preprocessorOptions: {
2929
scss: {
30-
additionalData: '@import "@/assets/styles/_functions.scss";@import "@/assets/styles/_variables.scss";@import "@/assets/styles/_mixins.scss";',
31-
},
32-
},
33-
},
34-
},
30+
additionalData: '@import "@/assets/styles/_functions.scss";@import "@/assets/styles/_variables.scss";@import "@/assets/styles/_mixins.scss";'
31+
}
32+
}
33+
}
34+
}
3535
// ssr: false
3636

3737
});

apps/front/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"generate": "nuxt generate",
77
"preview": "nuxt preview",
88
"postinstall": "nuxt prepare",
9-
"lint": "eslint nuxt.config.ts --fix ; eslint ./src/"
9+
"lint": "eslint nuxt.config.ts --fix ; nuxi typecheck ; eslint ./src/"
1010
},
1111
"devDependencies": {
1212
"@nuxt/eslint-config": "^0.1.1",
@@ -15,15 +15,15 @@
1515
"@types/http-proxy": "^1.17.11",
1616
"@types/lodash": "^4.14.195",
1717
"@typescript-eslint/eslint-plugin": "^5.59.7",
18-
"@vue/eslint-config-prettier": "^7.1.0",
1918
"eslint": "^8.41.0",
20-
"eslint-plugin-vue": "^9.14.1",
2119
"pino-pretty": "^10.0.0",
2220
"typescript": "^5.0.4",
2321
"vue-tsc": "^1.6.5"
2422
},
2523
"dependencies": {
24+
"@nuxtjs/eslint-config-typescript": "^12.0.0",
2625
"bootstrap": "^5.2.3",
26+
"defu": "^6.1.2",
2727
"h3": "^1.6.6",
2828
"nitropack": "^2.4.1",
2929
"nuxt": "3.5.1",

apps/front/src/components/layout/menu/AppMenu.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<div
33
class="d-flex flex-sm-column flex-row flex-nowrap bg-light align-items-center sticky-top"
44
>
5-
<NuxtLink to="/" class="d-block p-3 link-dark text-decoration-none">
5+
<NuxtLink
6+
to="/"
7+
class="d-block p-3 link-dark text-decoration-none"
8+
>
69
<icons1-square-fill />
710
</NuxtLink>
811
<ul

apps/front/src/components/layout/menu/MenuItem.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
22
<li class="nav-item">
3-
<NuxtLink v-bind="$attrs" class="nav-link py-3 px-2">
3+
<NuxtLink
4+
v-bind="$attrs"
5+
class="nav-link py-3 px-2"
6+
>
47
<slot />
58
</NuxtLink>
69
</li>

apps/front/src/composables/api/auth/useLogin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Me } from './useMe';
22

3-
export default function useLogin(): (email: string, password: string | undefined) => Promise<Me> {
3+
export default function useLogin (): (email: string, password: string | undefined) => Promise<Me> {
44
const { $appFetch } = useNuxtApp();
55
return async (email: string, password: string | undefined) => {
66
const response = await $appFetch<Me>('/api/1.0/auth/sso/saml2/login', {
77
method: 'post',
88
body: {
99
username: email,
10-
password,
11-
},
10+
password
11+
}
1212
});
1313
if (!response) {
1414
throw createError('/api/1.0/auth/sso/saml2/login has an empty body, the profile (me) should be returned');

apps/front/src/composables/api/auth/useMe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export interface Me {
22
username: string;
33
}
44

5-
export default function useMe(): () => Promise<Me> {
5+
export default function useMe (): () => Promise<Me> {
66
const { $appFetch } = useNuxtApp();
77
return async () => {
88
const res = await $appFetch<Me>('/api/1.0/auth/me');
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { FetchError } from 'ofetch';
2+
import { AsyncData } from '#app';
3+
import useAppFetch from '~/composables/useAppFetch';
4+
5+
interface LoggedHealthCheckResponse {
6+
success: string
7+
}
8+
export function useHealthCheckFetch (): AsyncData<LoggedHealthCheckResponse | null, FetchError | null> {
9+
return useAppFetch<LoggedHealthCheckResponse>(
10+
() => '/api/1.0/healthcheck/logged'
11+
);
12+
}

0 commit comments

Comments
 (0)