-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify version info on frontend by using api endpoint
- Loading branch information
Showing
6 changed files
with
45 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import {createApi, fetchBaseQuery} from "@reduxjs/toolkit/dist/query/react/index"; | ||
|
||
export const versionApi = createApi({ | ||
reducerPath: 'versionApi', | ||
baseQuery: fetchBaseQuery({ baseUrl: './api/' }), | ||
endpoints: (builder) => ({ | ||
getVersion: builder.query<{version: string}, undefined>({ | ||
query: () => `version`, | ||
}), | ||
}), | ||
}); | ||
|
||
const { useGetVersionQuery } = versionApi; | ||
|
||
const Version = () => { | ||
const { | ||
data = undefined, | ||
} = useGetVersionQuery(undefined); | ||
|
||
return <span className="px-4 break-normal"> | ||
Multi Scrobbler <span className="ml-2 text-xs version">{data === undefined ? null : `${data.version}`}</span> | ||
</span>; | ||
} | ||
|
||
export default Version; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
/// <reference types="vite/client" /> | ||
declare const __APP_VERSION__: string | ||
declare const __USE_HASH_ROUTER__: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters