Skip to content

Commit

Permalink
fix: issue with getting 401 when checking is user is logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
akinsey committed Feb 11, 2022
1 parent 17f81d2 commit 962e339
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/components/polls/PollViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default {
})
}
const votingEligible = () => {
if (!$auth.loggedIn) { return false }
if (!v.loggedIn) { return false }
else if (props.bannedFromBoard) { return false }
else if (!v.permissionUtils.hasPermission('threads.vote.allow')) { return false }
else if (v.pollCopy.locked) { return false }
Expand All @@ -155,7 +155,7 @@ export default {
}
/* View Methods */
const canLock = () => {
if (!$auth.loggedIn) { return false }
if (!v.loggedIn) { return false }
if (props.bannedFromBoard) { return false }
if (!v.permissionUtils.hasPermission('threads.lockPoll.allow')) { return false }
Expand All @@ -169,7 +169,7 @@ export default {
else return false
}
const canEdit = () => {
if (!$auth.loggedIn) { return false }
if (!v.loggedIn) { return false }
if (props.bannedFromBoard) { return false }
if (!v.permissionUtils.hasPermission('threads.editPoll.allow')) { return false }
Expand Down Expand Up @@ -296,6 +296,7 @@ export default {
/* View Data */
const v = reactive({
loggedIn: $auth.loggedIn,
permissionUtils: $auth.permissionUtils,
options: {
expiration: props.poll.expiration || undefined,
Expand Down
7 changes: 5 additions & 2 deletions src/views/Join.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ export default {
const $route = useRoute()
const $router = useRouter()
if ($auth.loggedIn) $auth.logout() // If user is currently logged in for some reason, log them out
/* Template Data */
const initForm = {
valid: false,
Expand All @@ -149,11 +147,16 @@ export default {
}
const v = reactive({
loggedIn: $auth.loggedIn,
form: cloneDeep(initForm),
focusInput: null,
showRegisterHideConfirm: true
})
if (v.loggedIn) $auth.logout() // If user is currently logged in for some reason, log them out
watch(() => v.focusInput, f => f ? v.focusInput.focus() : null)
/* Watch Data */
watch(() => v.form.email.val, debounce(async (val) => {
v.form.email.valid = val && val.length >= 3 && emailRegex.test(val)
Expand Down

0 comments on commit 962e339

Please sign in to comment.