-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
484 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,58 @@ | ||
<template> | ||
<div id="app"> | ||
<Loader v-show="loading" /> | ||
<div id="nav"> | ||
<router-link to="/">Home</router-link> | ||
<router-link to="/posts">Posts</router-link> | ||
<!-- TODO: It may be necessary to introduce a store pattern to adjust the display conditions --> | ||
<button @click="signout()">Signout</button> | ||
</div> | ||
<router-view /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Loader from "@/components/Loader.vue"; | ||
import apiClient from "./modules/apiClient"; | ||
import router from "./router"; | ||
export default { | ||
name: "App", | ||
components: { | ||
Loader | ||
}, | ||
data() { | ||
return { | ||
loading: false | ||
}; | ||
}, | ||
methods: { | ||
async signout() { | ||
try { | ||
this.loading = true; | ||
await apiClient | ||
.post( | ||
"/private/signout", | ||
{}, | ||
{ | ||
headers: { | ||
Authorization: "Bearer " + localStorage.getItem("access_token") | ||
} | ||
} | ||
) | ||
.then(() => { | ||
this.loading = false; | ||
this.isActive = false; | ||
localStorage.removeItem("access_token"); | ||
localStorage.removeItem("refresh_token"); | ||
router.push({ name: "Signin" }); | ||
}); | ||
} catch (e) { | ||
console.log(e); | ||
} finally { | ||
this.loading = false; | ||
} | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<ul> | ||
<li v-for="i of pagecount" :key="i"> | ||
<router-link | ||
:to="{ name: name, query: { page: i, limit: limit } }" | ||
:class="{ current: isCurrent(i) }" | ||
>{{ i }}</router-link | ||
> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "Pagination", | ||
props: { | ||
name: String, | ||
page: Number, | ||
limit: Number, | ||
pagecount: Number, | ||
refresh: Function | ||
}, | ||
methods: { | ||
isCurrent(i) { | ||
return i == this.page; | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.current { | ||
color: red; | ||
} | ||
</style> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const PUBLISH = "publish"; | ||
const DRAFT = "draft"; | ||
|
||
export default Object.freeze({ | ||
STATUS_PUBLIC: PUBLISH, | ||
STATUS_PRIVATE: DRAFT, | ||
STATUSES: [PUBLISH, DRAFT] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.