-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
151 additions
and
48 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,141 @@ | ||
import { OptionTable } from "@components/OptionTable"; | ||
|
||
# Config 配置信息 | ||
|
||
- [config/findUnique](#获取配置信息) 获取配置信息 | ||
- [config/upsert](#更新配置信息) 更新配置信息 | ||
|
||
## 获取配置信息 | ||
|
||
`config/findUnique` | ||
|
||
### 使用方式 | ||
|
||
TRPC | ||
|
||
```tsx copy | ||
const configQuery = trpc.config.findUnique.useQuery(); | ||
|
||
console.log(configQuery.data); | ||
``` | ||
|
||
HTTP | ||
|
||
```sh | ||
GET /trpc/config/findUnique | ||
``` | ||
|
||
### 参数 | ||
|
||
No Params | ||
|
||
### 返回值 | ||
|
||
<OptionTable | ||
options={[ | ||
["name", "string", "`config` 唯一值"], | ||
["language", "string", "语言"], | ||
[ | ||
"color", | ||
"string", | ||
<> | ||
外观 | 配色,具体可查看{" "} | ||
<a href="https://daisyui.com/docs/themes/">daisyui themes</a> | ||
</>, | ||
], | ||
["theme", "string", "WEB 主题"], | ||
[ | ||
"serverPort", | ||
"number", | ||
<> | ||
服务端 PORT <code>9301-9500</code> | ||
</>, | ||
], | ||
[ | ||
"clientPort", | ||
"number", | ||
<> | ||
客户端 PORT <code>9301-9500</code> | ||
</>, | ||
], | ||
["ip", "string", "当前 IP 改变后会自动更新"], | ||
]} | ||
/> | ||
|
||
## 更新配置信息 | ||
|
||
`config/upsert` | ||
|
||
### 请求参数 | ||
|
||
<OptionTable | ||
options={[ | ||
["language?", `"zh-cn" | "en-us" | "zh-tw" | undefined`, "设置语言"], | ||
[ | ||
"theme?", | ||
<> | ||
默认值 <code>taga-basic</code> | ||
</>, | ||
"设置主题", | ||
], | ||
[ | ||
"color?", | ||
<> | ||
参考 <a href="https://daisyui.com/docs/themes/">daisyui themes</a> | ||
</>, | ||
"设置配色", | ||
], | ||
]} | ||
/> | ||
|
||
### 使用方式 | ||
|
||
TRPC | ||
|
||
```ts copy | ||
const { mutate: updateConfig } = trpc.config.upsert.useMutation(); | ||
|
||
// 传入需要更新的字段 | ||
updateConfig.mutate({ | ||
language: "zh-cn", | ||
}); | ||
``` | ||
|
||
HTTP | ||
|
||
```sh | ||
POST /trpc/config/upsert | ||
``` | ||
|
||
### 返回值 | ||
|
||
<OptionTable | ||
options={[ | ||
["name", "string", "`config` 唯一值"], | ||
["language", "string", "语言"], | ||
[ | ||
"color", | ||
"string", | ||
<> | ||
外观 | 配色,具体可查看{" "} | ||
<a href="https://daisyui.com/docs/themes/">daisyui themes</a> | ||
</>, | ||
], | ||
["theme", "string", "WEB 主题"], | ||
[ | ||
"serverPort", | ||
"number", | ||
<> | ||
服务端 PORT <code>9301-9500</code> | ||
</>, | ||
], | ||
[ | ||
"clientPort", | ||
"number", | ||
<> | ||
客户端 PORT <code>9301-9500</code> | ||
</>, | ||
], | ||
["ip", "string", "当前 IP 改变后会自动更新"], | ||
]} | ||
/> |
File renamed without changes.