Compare commits
2 Commits
d31c774ace
...
002cf9a4b1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
002cf9a4b1 | ||
|
|
efe9c01e63 |
@@ -239,6 +239,25 @@ const onConflictOverwrite = async () => {
|
|||||||
const onConflictCancel = () => {
|
const onConflictCancel = () => {
|
||||||
if (mode.value === "read") toggleMode()
|
if (mode.value === "read") toggleMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onBadgeClick = async () => {
|
||||||
|
if (freshnessStatus.value !== "outdated") {
|
||||||
|
await checkFreshness()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasUnsavedEdits = rawContent.value !== initialRawContent.value
|
||||||
|
if (hasUnsavedEdits) {
|
||||||
|
conflictOpen.value = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const newRaw = await pullLatest()
|
||||||
|
if (newRaw !== null) {
|
||||||
|
rawContent.value = newRaw
|
||||||
|
initialRawContent.value = newRaw
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -270,7 +289,7 @@ const onConflictCancel = () => {
|
|||||||
<note-freshness-badge
|
<note-freshness-badge
|
||||||
:status="freshnessStatus"
|
:status="freshnessStatus"
|
||||||
:last-checked-at="lastCheckedAt"
|
:last-checked-at="lastCheckedAt"
|
||||||
@click="checkFreshness"
|
@click="onBadgeClick"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
v-if="isMarkdown"
|
v-if="isMarkdown"
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ export const useGitHubContent = ({
|
|||||||
const octokit = await getOctokit()
|
const octokit = await getOctokit()
|
||||||
const response = await octokit.request(
|
const response = await octokit.request(
|
||||||
"GET /repos/{owner}/{repo}/contents/{path}",
|
"GET /repos/{owner}/{repo}/contents/{path}",
|
||||||
{ owner: user, repo, path }
|
{
|
||||||
|
owner: user,
|
||||||
|
repo,
|
||||||
|
path,
|
||||||
|
headers: { "X-GitHub-Api-Version": "2022-11-28" }
|
||||||
|
}
|
||||||
)
|
)
|
||||||
const data = response?.data
|
const data = response?.data
|
||||||
if (Array.isArray(data) || !data) return null
|
if (Array.isArray(data) || !data) return null
|
||||||
|
|||||||
Reference in New Issue
Block a user