Skip to content

Commit f5b2f8a

Browse files
authored
Merge pull request #18 from Dialogue-Bot/DIAL-21-Ui-settings
DIAL-21-Ui-settings
2 parents 51af836 + 443484c commit f5b2f8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2202
-75
lines changed

client/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
.env

client/package-lock.json

Lines changed: 208 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"class-variance-authority": "^0.7.0",
4949
"clsx": "^2.1.0",
5050
"cmdk": "^0.2.1",
51+
"crypto-js": "^4.2.0",
5152
"date-fns": "^3.3.1",
5253
"embla-carousel-react": "^8.0.0-rc23",
5354
"firebase": "^10.8.0",
@@ -73,6 +74,7 @@
7374
},
7475
"devDependencies": {
7576
"@tanstack/router-vite-plugin": "^1.16.5",
77+
"@types/crypto-js": "^4.2.2",
7678
"@types/node": "^20.11.19",
7779
"@types/react": "^18.2.55",
7880
"@types/react-dom": "^18.2.19",
@@ -87,6 +89,7 @@
8789
"tailwindcss": "^3.4.1",
8890
"typescript": "^5.2.2",
8991
"vite": "^5.1.0",
92+
"vite-plugin-markdown": "^2.2.0",
9093
"vite-tsconfig-paths": "^4.3.1"
9194
}
9295
}

client/src/apis/setting.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ENDPOINTS } from '@/constants';
2+
import http_client from '@/lib/http-client';
3+
import { TSetting } from '@/types/setting';
4+
import { TBaseResponse } from '@/types/share';
5+
import { decrypt, encrypt } from '@/utils';
6+
7+
class SettingApi {
8+
async getSetting(): Promise<TBaseResponse<TSetting>> {
9+
const res: TBaseResponse<string> = await http_client.get(
10+
ENDPOINTS.SETTING.INDEX
11+
);
12+
13+
return {
14+
data: JSON.parse(decrypt(res.data)),
15+
message: res.message,
16+
};
17+
}
18+
19+
updateMailSetting(
20+
data: TSetting['email']
21+
): Promise<TBaseResponse<TSetting['email']>> {
22+
return http_client.put(ENDPOINTS.SETTING.MAIL, {
23+
encrypted: encrypt(JSON.stringify(data)),
24+
});
25+
}
26+
}
27+
28+
export const settingApi = new SettingApi();

client/src/apis/upload.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { ENDPOINTS } from '@/constants';
2+
import http_client from '@/lib/http-client';
3+
import { TBaseResponse } from '@/types/share';
4+
5+
export class UploadApi {
6+
single(file: File): Promise<TBaseResponse<string>> {
7+
const formData = new FormData();
8+
9+
formData.append('file', file);
10+
11+
return http_client.post(ENDPOINTS.UPLOAD.SINGLE, formData, {
12+
headers: {
13+
'Content-Type': 'multipart/form-data',
14+
},
15+
});
16+
}
17+
}
18+
19+
export const uploadApi = new UploadApi();

0 commit comments

Comments
 (0)