generated from kevisual/vite-react-template
chore: update dependencies and improve configuration handling
- Bump version to 0.0.7 in package.json and update deployment script. - Add new dependencies in bun.lock for improved functionality. - Modify loadFromRemote methods in Gitea and general config stores to return boolean for better error handling. - Enhance BuildConfig component to ensure proper loading state management. - Simplify RepoCard component by removing duplicate repository access option. - Update WorkspaceDetailDialog to include workspace link in state management. - Fix branch default value in createDevConfig function to use a placeholder.
This commit is contained in:
@@ -9,7 +9,7 @@ type ConfigState = {
|
||||
setConfig: (config: Partial<Config>) => void;
|
||||
resetConfig: () => void;
|
||||
saveToRemote: () => Promise<void>;
|
||||
loadFromRemote: () => Promise<void>;
|
||||
loadFromRemote: () => Promise<boolean>;
|
||||
checkConfig: (opts?: { isUser?: boolean, reload?: boolean }) => Promise<boolean>;
|
||||
};
|
||||
|
||||
@@ -75,22 +75,24 @@ export const useConfigStore = create<ConfigState>()(
|
||||
})
|
||||
if (res.code === 404) {
|
||||
toast.error('远端配置不存在')
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (res.code === 200) {
|
||||
const config = res.data?.data as typeof config;
|
||||
setConfig(config);
|
||||
toast.success('获取远端配置成功')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
checkConfig: async (opts?: { isUser?: boolean, reload?: boolean }) => {
|
||||
const { CNB_API_KEY } = get().config;
|
||||
if (!CNB_API_KEY && opts?.isUser) {
|
||||
await get().loadFromRemote();
|
||||
if (opts?.reload) {
|
||||
const res = await get().loadFromRemote();
|
||||
if (opts?.reload && res) {
|
||||
location.reload();
|
||||
}
|
||||
return true
|
||||
return res;
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user