Skip to content

Commit

Permalink
Merge branch 'master' of github.com:prose-im/prose-pod-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Jan 6, 2025
2 parents 78fec48 + 191501a commit 21e1850
Show file tree
Hide file tree
Showing 51 changed files with 1,170 additions and 965 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
143 changes: 142 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"typescript": "4.9.x",
"vite": "5.4.x",
"vite-plugin-pug-transformer": "1.0.x",
"vite-plugin-svg-icons": "2.0.x"
"vite-plugin-svg-icons": "2.0.x",
"vue-tsc": "1.8.x"
}
}
31 changes: 28 additions & 3 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import CONFIG from "@/commons/config";

// PROJECT: STORES
import store from "@/store";
import BaseAlert from "@/components/base/BaseAlert.vue";
import router from "@/router";

/**************************************************************************
* CONSTANTS
Expand Down Expand Up @@ -44,10 +46,33 @@ class API {
// Do something with response data
return response;
},
function (error) {
if (error.status === 403) {
store.$account.logout();
async function (error) {
// Check if the error response status is 403 before logging out
if (error.response && error.response.status === 403) {
try {
// Logout from account
await store.$account.logout();

// Redirect to login page
console.log("router", router.instance());

router
.instance()
.push("/start/login")
.catch(err => {
// Handle redundant navigation error
console.error("error reroute:", err);
});

// Acknowledge logout success
BaseAlert.info("Logged out", "Logged out of your dashboard");
} catch (_) {
console.error("router error", _);
BaseAlert.error("Could not log out", "Maybe try again?");
}
}
// Handle other errors globally if needed

return Promise.reject(error);
}
);
Expand Down
7 changes: 3 additions & 4 deletions src/api/providers/advancedSecurity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import Api from "@/api";
* ************************************************************************* */

interface WorkspaceNameResponse {
name: string
name: string;
}

interface WorkspaceIconResponse {
icon: string
icon: string;
}

interface WorkspaceDetailsCardResponse {
Expand All @@ -29,15 +29,14 @@ interface WorkspaceDetailsCardResponse {
}

interface WorkspaceColorResponse {
color: string
color: string;
}

/**************************************************************************
* API
* ************************************************************************* */

export class APIAdvancedSecurity {

/** WORKSPACE PROFILE **/

async getWorkspaceName(): Promise<WorkspaceNameResponse> {
Expand Down
21 changes: 12 additions & 9 deletions src/api/providers/customizationWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
import Api from "@/api";

/**************************************************************************
* INTERFACES
* INTERFACES
* ************************************************************************* */

interface WorkspaceNameResponse {
name: string
name: string;
}

interface WorkspaceIconResponse {
icon: string
icon: string;
}

interface WorkspaceDetailsCardResponse {
Expand All @@ -29,14 +29,18 @@ interface WorkspaceDetailsCardResponse {
}

interface WorkspaceColorResponse {
color: string
color: string;
}

/**************************************************************************
* TYPES
* TYPES
* ************************************************************************* */

type WorkspaceConfigResponse = [WorkspaceNameResponse, WorkspaceIconResponse, WorkspaceColorResponse]
type WorkspaceConfigResponse = [
WorkspaceNameResponse,
WorkspaceIconResponse,
WorkspaceColorResponse
];

/**************************************************************************
* API
Expand All @@ -51,7 +55,6 @@ export class APICustomizationWorkspace {
this.getWorkspaceIcon(),
this.getWorkspaceColor()
]);

}

/** WORKSPACE PROFILE **/
Expand All @@ -72,7 +75,7 @@ export class APICustomizationWorkspace {

async setWorkspaceIcon(newIcon: string): Promise<void> {
await Api.client.put("/workspace/icon", {
method: 'put',
method: "put",
image: newIcon
});
}
Expand All @@ -87,7 +90,7 @@ export class APICustomizationWorkspace {
});
}

/** APPEARANCE **/
/** APPEARANCE **/

async getWorkspaceColor(): Promise<WorkspaceColorResponse> {
return (await Api.client.get("/workspace/accent-color")).data;
Expand Down
Loading

0 comments on commit 21e1850

Please sign in to comment.