Skip to content

Commit

Permalink
Fixed bug where if session token was deleted the page did not work.
Browse files Browse the repository at this point in the history
  • Loading branch information
elrumo committed Mar 21, 2021
1 parent cc13e4c commit bef372e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 16 deletions.
1 change: 1 addition & 0 deletions website/macos-big-sur-icons/src/assets/icons/Discord.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions website/macos-big-sur-icons/src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@
<a href="https://twitter.com/elrumo" class="" target="_blank" rel="noopener">
<img :src="icons.twitter" class="header-item header-icon" alt="Twitter logo">
</a>
<a href="https://discord.gg/spkQYzBZ" class="" target="_blank" rel="noopener">
<!-- <img :src="icons.discord" class="header-item header-icon" alt="Discord Logo"> -->
<a href="https://discord.gg/spkQYzBZ" class="p-l-20" target="_blank" rel="noopener">
<img :src="icons.discord" class="header-item header-icon" alt="Discord Logo">
</a>
</div>
<!-- Back to all icons -->
Expand Down Expand Up @@ -225,6 +225,7 @@ export default {
darkMode: false,
icons:{
twitter: require("../assets/icons/twitter.svg"),
discord: require("../assets/icons/Discord.svg"),
burgerMenu: require("../assets/icons/burgerMenu.svg"),
},
isMenu: false,
Expand Down
41 changes: 28 additions & 13 deletions website/macos-big-sur-icons/src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<div v-if="this.$store.state.list == 0 & !loadingError" class="waiting-wrapper">
<coral-wait size="L" indeterminate=""></coral-wait>
</div>

<!-- Loading error -->
<div v-if="loadingError" class="waiting-wrapper">

Expand Down Expand Up @@ -423,21 +424,35 @@ export default {
}
// Parse.User.enableUnsafeCurrentUser()
function handleParseError(err){
switch (err.code) {
case Parse.Error.INVALID_SESSION_TOKEN:
Parse.User.logOut();
loginParse()
break;
default:
break;
}
}
if(Parse.User.current()){
if (Parse.User.current().attributes.isAdmin) {
parent.getIconsArray();
parent.isAuth = true
}else{
parent.getIconsArray();
function loginParse(){
if(Parse.User.current()){
if (Parse.User.current().attributes.isAdmin) {
parent.getIconsArray();
parent.isAuth = true
}else{
parent.getIconsArray();
}
} else{
Parse.User.logIn(parseUser, parsePass).then(()=>{
console.log("Signed Insss");
parent.getIconsArray();
}).catch((e)=>{
console.log("login: ", e);
handleParseError(e)
})
}
} else{
Parse.User.logIn(parseUser, parsePass).then(()=>{
console.log("Signed Insss");
parent.getIconsArray();
}).catch((e)=>{
console.log("login: ", e);
})
}
},
Expand Down
26 changes: 25 additions & 1 deletion website/macos-big-sur-icons/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -478,17 +478,41 @@ export default {
document.getElementById(id).style.display = "none"
}
function handleParseError(err){
switch (err.code) {
case Parse.Error.INVALID_SESSION_TOKEN:
Parse.User.logOut();
window.location.reload()
break;
default:
break;
}
}
if (currentUser) {
if (!Parse.User.current().attributes.isAdmin) {
parent.$router.push({ path: '/' })
Parse.User.logOut();
console.log("Hiii");
return
}
parent.isAuth = true
async function getParseData(){
const query = new Parse.Query(Icons);
query.equalTo("approved", false)
query.ascending("usersName");
query.limit(docLimit);
const results = await query.find()
try{
var results = await query.find()
} catch (error) {
console.log(error);
handleParseError(error)
}
parent.getIconListLen(query); // Get how many icons to approve.
Expand Down

1 comment on commit bef372e

@vercel
Copy link

@vercel vercel bot commented on bef372e Mar 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.