Change get articles to read from database instead of dummy data.
This commit is contained in:
@@ -6,8 +6,9 @@ const feeds = ref([]);
|
||||
const buttonText = 'Sync'
|
||||
|
||||
const fetchData = async () => {
|
||||
const user_id = localStorage.getItem("user-id")
|
||||
try {
|
||||
const response = await axios.get('feeds/get', {
|
||||
const response = await axios.get("feeds/get/" + user_id, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'user-token': localStorage.getItem("user-token")
|
||||
@@ -22,7 +23,7 @@ const fetchData = async () => {
|
||||
async function sync() {
|
||||
try {
|
||||
const repsponse = await axios.post('feeds/sync', {
|
||||
user_id: localStorage.getItem("user-id")
|
||||
user_id: 1 //localStorage.getItem("user-id")
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -46,6 +47,7 @@ onMounted(() => {
|
||||
<div>
|
||||
<h1>Feeds</h1> <button @click="sync">{{ buttonText }}</button>
|
||||
<div id='aricle'>
|
||||
<p v-if="feeds.length == 0">No unread articles.</p>
|
||||
<template v-for="feed in feeds">
|
||||
<h2>{{ feed.title }}</h2>
|
||||
<p v-html='feed.content'></p>
|
||||
|
||||
Reference in New Issue
Block a user