diff --git a/src/app/services/server.ts b/src/app/services/server.ts index 2be7b7b3..5d66ce09 100644 --- a/src/app/services/server.ts +++ b/src/app/services/server.ts @@ -1,6 +1,6 @@ import { createApi } from "@reduxjs/toolkit/query/react"; import BASE_URL from "../config"; -import { updateInfo } from "../slices/server"; +import { updateInfo, StoredServer } from "../slices/server"; import baseQuery from "./base.query"; import { RootState } from "../store"; import { User } from "../../types/auth"; @@ -9,7 +9,6 @@ import { GoogleAuthConfig, LoginConfig, Server, - StoredServer, TestEmailDTO, NewAdminDTO, SMTPConfig, diff --git a/src/app/slices/server.ts b/src/app/slices/server.ts index e5d7593d..9f75798c 100644 --- a/src/app/slices/server.ts +++ b/src/app/slices/server.ts @@ -1,16 +1,14 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import { Server } from "../../types/server"; -interface State { - name: string; - description: string; +export interface StoredServer extends Server { logo: string; - inviteLink: { + inviteLink?: { link: string; expire: number; }; } - -const initialState: State = { +const initialState: StoredServer = { name: "", description: "", logo: "", @@ -27,7 +25,7 @@ const serverSlice = createSlice({ resetServer() { return initialState; }, - fullfillServer(state, action: PayloadAction) { + fullfillServer(state, action: PayloadAction) { const { inviteLink = { link: "", @@ -39,7 +37,7 @@ const serverSlice = createSlice({ } = action.payload || {}; return { name, logo, description, inviteLink }; }, - updateInfo(state, action: PayloadAction>) { + updateInfo(state, action: PayloadAction>) { const values = action.payload || {}; // todo: check and remove old logic // Object.keys(values).forEach((_key) => { diff --git a/src/types/server.ts b/src/types/server.ts index a9bf70b1..b46600ea 100644 --- a/src/types/server.ts +++ b/src/types/server.ts @@ -3,9 +3,6 @@ export interface Server { name: string; description: string; } -export interface StoredServer extends Server { - logo: string; -} export interface GithubAuthConfig { client_id: string; client_secret: string;