mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
Added full Article creation pathway
This commit is contained in:
@@ -21,4 +21,16 @@ export async function getArticle(id: string) : Promise<Article> {
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
})
|
||||
}
|
||||
|
||||
export async function postArticle(article: Article) : Promise<object> {
|
||||
return await fetch(`${baseURL}/articles/${article.idName}`, {
|
||||
method: 'POST',
|
||||
headers: { "Authorization": `Bearer ${useAuthStore().token}` },
|
||||
body: JSON.stringify(article)
|
||||
})
|
||||
.then(result => result.json())
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user