Skip to content

Commit

Permalink
fix: removed unnecessary comment, refactored json tag launched
Browse files Browse the repository at this point in the history
  • Loading branch information
rowangamal committed Aug 12, 2024
1 parent 8aefc54 commit fcde9b3
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 34 deletions.
2 changes: 0 additions & 2 deletions client/src/layouts/default/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ export default {
if (title == "Logout") {
localStorage.removeItem("token");
localStorage.removeItem("username");
// localStorage.removeItem("nextlaunch");
// localStorage.setItem("nextlaunch", "true");
items.value = [
{
path: "about",
Expand Down
2 changes: 0 additions & 2 deletions client/src/layouts/default/Default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default {
const router = useRouter();
const maintenance = ref(false);
const nextlaunch = ref(true);
// const nextlaunchflag = ref(true);
const noQuota = ref(false);
const excludedRoutes = ref([
"/",
Expand All @@ -44,7 +43,6 @@ export default {
userService.maintenance();
maintenance.value = localStorage.getItem("maintenance") == "true";
// userService.nextlaunch();
nextlaunch.value = localStorage.getItem("nextlaunch") == "true";
const isAdmin = computed(() => {
Expand Down
2 changes: 0 additions & 2 deletions client/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,8 @@ const router = createRouter({
router.beforeEach(async (to, from, next) => {
let token = localStorage.getItem("token");
userService.maintenance();
// userService.nextlaunch();

if (to.meta.requiredAuth && !token) {
// userService.nextlaunch();
next("/login");
} else if (to.path == "/" && token) {
await userService.refresh_token();
Expand Down
6 changes: 1 addition & 5 deletions client/src/services/userService.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,11 @@ export default {

// next launch
async nextlaunch() {
// await this.refresh_token();
return await baseClient()
.get("/nextlaunch")
.then((response) => {
const { data } = response.data;
localStorage.setItem("nextlaunch", data.active);
localStorage.setItem("nextlaunch", data.launched);
})
.catch((response) => {
const { err } = response.response.data;
Expand All @@ -223,9 +222,6 @@ export default {
if (isAdmin) {
localStorage.setItem("nextlaunch", "true");
}
// else {
// this.nextlaunch();
// }
})
},
};
17 changes: 0 additions & 17 deletions client/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ import axios from "axios";
import Toast from "@/components/Toast.vue";
import { useRouter } from "vue-router";
import userService from "@/services/userService";
// import userService from "@/services/userService";
// import NextLaunch from "./NextLaunch.vue";
export default {
components: {
Expand Down Expand Up @@ -142,24 +140,9 @@ export default {
localStorage.setItem("token", response.data.data.access_token);
toast.value.toast(response.data.msg);
adminCheck();
// userService.handleNextLaunch();
// userService.getUser()
// .then((response) => {
// const { user } = response.data.data;
// const isAdmin = user.admin;
// if (isAdmin) {
// localStorage.setItem("nextlaunch", "true");
// }
// })
// if(localStorage.getItem("nextlaunch") == "true") {
router.push({
name: "Home",
});
// } else{
// router.push({
// name: "NextLaunch",
// })
// }
})
.catch((error) => {
toast.value.toast(error.response.data.err, "#FF5252");
Expand Down
1 change: 0 additions & 1 deletion server/app/admin_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/codescalers/cloud4students/internal"
// "github.com/codescalers/cloud4students/middlewares"
"github.com/codescalers/cloud4students/models"
"github.com/rs/zerolog/log"
"gopkg.in/validator.v2"
Expand Down
4 changes: 0 additions & 4 deletions server/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ func (a *App) registerHandlers() {
notificationRouter := authRouter.PathPrefix("/notification").Subrouter()
vmRouter := authRouter.PathPrefix("/vm").Subrouter()
k8sRouter := authRouter.PathPrefix("/k8s").Subrouter()
// authNextLaunchRouter := authRouter.PathPrefix("/nextlaunch").Subrouter()

// sub routes with no authorization
unAuthUserRouter := versionRouter.PathPrefix("/user").Subrouter()
Expand All @@ -127,8 +126,6 @@ func (a *App) registerHandlers() {
unAuthUserRouter.HandleFunc("/forgot_password", WrapFunc(a.ForgotPasswordHandler)).Methods("POST", "OPTIONS")
unAuthUserRouter.HandleFunc("/forget_password/verify_email", WrapFunc(a.VerifyForgetPasswordCodeHandler)).Methods("POST", "OPTIONS")

// authMaintenanceRouter.HandleFunc("/maintenance", WrapFunc(a.GetMaintenanceHandler)).Methods("GET", "OPTIONS")

userRouter.HandleFunc("/change_password", WrapFunc(a.ChangePasswordHandler)).Methods("PUT", "OPTIONS")
userRouter.HandleFunc("", WrapFunc(a.UpdateUserHandler)).Methods("PUT", "OPTIONS")
userRouter.HandleFunc("", WrapFunc(a.GetUserHandler)).Methods("GET", "OPTIONS")
Expand Down Expand Up @@ -163,7 +160,6 @@ func (a *App) registerHandlers() {
adminRouter.HandleFunc("/deployment/count", WrapFunc(a.GetDlsCountHandler)).Methods("GET", "OPTIONS")
adminRouter.HandleFunc("/announcement", WrapFunc(a.CreateNewAnnouncement)).Methods("POST", "OPTIONS")
adminRouter.HandleFunc("/set_admin", WrapFunc(a.SetAdmin)).Methods("PUT", "OPTIONS")
// adminRouter.HandleFunc("/nextlaunch", WrapFunc(a.GetNextLaunchAdminHandler)).Methods("GET", "OPTIONS")
balanceRouter.HandleFunc("", WrapFunc(a.GetBalanceHandler)).Methods("GET", "OPTIONS")
maintenanceRouter.HandleFunc("", WrapFunc(a.UpdateMaintenanceHandler)).Methods("PUT", "OPTIONS")
deploymentsRouter.HandleFunc("", WrapFunc(a.DeleteAllDeployments)).Methods("DELETE", "OPTIONS")
Expand Down
2 changes: 1 addition & 1 deletion server/models/nextlaunch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import "time"
// NextLaunch struct for next launch revealing
type NextLaunch struct {
ID int `json:"id" gorm:"primaryKey"`
Launched bool `json:"active"`
Launched bool `json:"launched"`
UpdatedAt time.Time `json:"updated_at"`
}

0 comments on commit fcde9b3

Please sign in to comment.