diff --git a/web/admin-gui/src/router/index.ts b/web/admin-gui/src/router/index.ts index e660c56..e6b7a88 100644 --- a/web/admin-gui/src/router/index.ts +++ b/web/admin-gui/src/router/index.ts @@ -44,7 +44,7 @@ const router = createRouter({ } }, { - path: '/articles/edit/:articleID?', + path: '/articles/edit/:articleID', name: 'edition', component: ArticlesEdit, meta: { @@ -53,10 +53,10 @@ const router = createRouter({ }, { path: '/articles/new', - name: 'edition', + name: 'new', component: ArticlesNew, meta: { - title: 'GohCMS - Edition' + title: 'GohCMS - Nouveau' } }, ] diff --git a/web/admin-gui/src/utils/database.ts b/web/admin-gui/src/utils/database.ts new file mode 100644 index 0000000..8416e6c --- /dev/null +++ b/web/admin-gui/src/utils/database.ts @@ -0,0 +1,24 @@ +import { useAuthStore } from "@/stores/AuthStore" + +export interface Article { + idName: string, + date: number, + content: { + html: string + }, + pageId: string, + online: boolean +} + +const baseURL = `http://${__APP_ENV__.APP_HOST_ADDRESS}:${__APP_ENV__.APP_API_PORT}` + +export async function getArticle(id: string) : Promise
{ + return await fetch(`${baseURL}/articles/${id}`, { + method: 'GET', + headers: { "Authorization": `Bearer ${useAuthStore().token}` } + }) + .then(result => result.json()) + .catch(error => { + console.error(error) + }) +} \ No newline at end of file diff --git a/web/admin-gui/src/views/ArticlesEdit.vue b/web/admin-gui/src/views/ArticlesEdit.vue index 28babb0..45ce695 100644 --- a/web/admin-gui/src/views/ArticlesEdit.vue +++ b/web/admin-gui/src/views/ArticlesEdit.vue @@ -1,11 +1,17 @@